gcc -o hello hello.c -I /home/hello/include -L /home/hello/lib -lworld
參數說明:
-
-I /home/hello/include表示將 /home/hello/include 目錄作爲第一個尋找頭文件的目錄,尋找的順序是:/home/hello/include–>/usr/include–>/usr/local/include
-
-L /home/hello/lib 表示將 /home/hello/lib 目錄作爲第一個尋找庫文件的目錄,尋找的順序是:/home/hello/lib–>/lib–>/usr/lib–>/usr/local/lib
-
-lworld表示在上面的lib的路徑中尋找libworld.so動態庫文件