Linking libraries with gcc: order of arguments

As soon as I upgraded my Ubuntu distro to 11.10, I started seeing strange linker behavior with gcc. I was able to fix the problem by moving my -l arguments to the end of the gcc command (my problem was similar to the one described in this thread, and the proposed solution worked for me...thanks!).

My question is...why did I have this problem only now? I've been developing and testing this code on OS X and Ubuntu for a while: I never knew that -l commands are supposed to go after your .c files, but even so, this never gave me problems before. I'm guessing it has more to do with the version of GCC than the Ubuntu release version.

Is this newer version simply enforcing this requirement more strictly than earlier versions?

链接地址: http://www.djcxy.com/p/85762.html

上一篇: gcc中共享库函数的静态链接

下一篇: 链接库与gcc:参数的顺序