I have been using NetBeans IDE to build my program with its auto generated make file. Then I noticed the binary file generated depends on the order of linking. For example
,Code:g++ -static -o myprogram a.o b.o c.o d.o e.o -la -lb -lc
(change order of libraries), andCode:g++ -static -o myprogram a.o b.o c.o d.o e.o -lb -la -lc
(change order of object files) all produce different binaries, even though the libraries and object files are all identical in each of the three cases.Code:g++ -static -o myprogram c.o d.o e.o a.o b.o -la -lb -lc
So here are my questions:
How does NetBeans decide the order of linking and how to change it?
Does the order of linking affect performance and if so how to optimize it?
Thank you!




Reply With Quote