GNU Link Order

-l library
Search the library named library when linking.
It makes a difference where in the command you write this option; the linker searches and processes libraries and object files in the order they are specified. Thus, `foo.o -lz bar.o’ searches library `z’ after file foo.o but before bar.o. If bar.o refers to functions in `z’, those functions may not be loaded.

就是说在某些编译器下,link 的时候需要按照静态库的依赖关系来指定链接顺序,被最多依赖的库需要放到最后。


This entry was posted in Computer and Internet, Operation System and Linux, Programming and Algorithm. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s