2010年5月28日 星期五

gcc -l 的位置....很重要...T_T

Using the GNU Compiler Collection (GCC) - 3.13 Options for Linking
http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html

-llibrary
-l library

(..................)

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.



[筆記] gcc參數指令(轉錄)

http://aikosenoo.pixnet.net/blog/post/23038692
-lLIBRARY
連結時尋找 LIBRARY.a程式庫作為程式庫來源,本參數所指的程式庫為附加方式,即標準程式庫仍會用來作連結,不管本參數有設定,而相關的目錄路徑則為標準路徑加上-L所指定的路徑;如果參數列中有兩個以上的目的檔,本參數的位置有很大的影響,如在 "foo.o -lz bar.o"中 -lz只對 foo.o有效,即 bar.z無法連結到 z.a中的特定函數。

沒有留言: