Mail Archives: djgpp/1995/02/13/11:22:11
>>
>> 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.
- Raw text -