[問題] 想請問Unix Network Programming一書的 …

看板LinuxDev作者 (OK的啦~我都可以接受)時間17年前 (2008/04/02 00:39), 編輯推噓2(203)
留言5則, 2人參與, 最新討論串1/2 (看更多)
小弟我最近開始讀Advance Programming in the UNIX Environment一書 想要嚐試code 書中的程式碼 也就照著書上提供的網頁 去下載了apue.h 並且解壓縮編譯後放在/usr/include這個資料夾中 可是在我編譯程式的的時候 會出現以下的錯誤 /tmp/cckYAUFP.o: In function `thr_fn': test_unix_programming.c:(.text+0xed): undefined reference to `pthread_sigmask' test_unix_programming.c:(.text+0x104): undefined reference to `err_sys' /tmp/cckYAUFP.o: In function `main': test_unix_programming.c:(.text+0x295): undefined reference to `err_quit' test_unix_programming.c:(.text+0x2d3): undefined reference to `err_quit' test_unix_programming.c:(.text+0x327): undefined reference to `err_sys' test_unix_programming.c:(.text+0x35f): undefined reference to `pthread_create' test_unix_programming.c:(.text+0x37b): undefined reference to `err_exit' test_unix_programming.c:(.text+0x3b3): undefined reference to `pthread_sigmask' test_unix_programming.c:(.text+0x3c3): undefined reference to `err_sys' collect2: ld 回傳 1 可是我去看 apue.h 裡面 ,都有這些函式 不知道是那裡出現了問題 希望各位大大指點一下 告訴我該怎麼樣才能使用apue.h @@ 感謝大家<(_ _)> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.243.43 ※ 編輯: king19880326 來自: 140.112.243.43 (04/02 00:42) ※ 編輯: king19880326 來自: 140.112.243.43 (04/02 00:47)

04/02 02:33, , 1F
麻煩先告知一下你的unix是那一套
04/02 02:33, 1F

04/02 02:35, , 2F
現在可以了 可是必須要在編譯時加上-lm 函式庫位置
04/02 02:35, 2F

04/02 02:36, , 3F
有什麼方法可以讓gcc自動找到他嗎??我是用Ubuntu7.10
04/02 02:36, 3F

04/02 15:13, , 4F
= = 什麼叫自動找到他 ....請了解gcc是什麼-lm又是什麼
04/02 15:13, 4F

04/02 15:14, , 5F
你的問題請寫makefile
04/02 15:14, 5F
文章代碼(AID): #17ycLJIA (LinuxDev)
文章代碼(AID): #17ycLJIA (LinuxDev)