John Graham wrote: > I have a question about using g++ as a linker, and the order in which > you specify search paths. > > As I understand it, g++ -lx -ly will search libx.a before liby.so. > When I'm compiling a particular application, I usually put something > like: > > g++ obj.o -lmylib > > to compile obj.o and link in libmylib.a, which works just dandy. > However, when I specify: > > g++ -lmylib obj.o > > then I get link errors about not being able to find symbols defined in > libmylib.a! Why is this? Is this a bug, or the intended behaviour? > Is there any way to change this behaviour on the command-line (it > would make life easer for me with an existing tool I want to use that > wants to insert my -l*'s before my *.o's) The linker always scans from left to right, so that's the order you must use on the command line. Andrew.