To: Barnett C Hsu Cc: Bill Davidson , Mark Hull-Richter , djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: Problems with (first compile under) djgpp/gcc Date: Thu, 09 Feb 95 07:55:13 +0200 From: "Eli Zaretskii" >> >> The order of arguments to gcc or ld should make no difference. >> > > Maybe it's just me, but it does seem to make a difference when > compiling C++ code. If I do "gcc -lgpp test.cc", I get a whole > lot of linker errors all on C++ stuff. But if I do > "gcc test.cc -lgpp", everything is happy and the errors go away. The relative order of the libraries does matter, and also the fact that you must put all the libraries AFTER all the objects, but the relative order of the objects (usually) shouldn't matter. In the original posting, the issue was about object files' order. GNU ld (like most of Unix linkers I've seen) is a one-pass linker, which makes it unhappy if you move a library before the object file which calls functions in that library.