天天看點

怎樣徹底解決"undefined reference to `pthread_create'"問題

在編寫pthread有關的程式時,編譯時老是報"undefined reference to `pthread_create'"的錯誤,

原因是沒有連結pthread相關的庫,gcc加上-lrt就可以了.

我想怎樣預設去連結這個庫了?不要再加個"-lrt"了

怎樣徹底解決"undefined reference to `pthread_create'"問題

也就是"/usr/lib/"下的libpthread.a,

應該在哪個配置檔案中進行配置了?

[ 本帖最後由 osmanthusgfy 于 2009-9-27 23:23 編輯 ]

最佳答案

怎樣徹底解決"undefined reference to `pthread_create'"問題

noword2k 檢視完整内容

設定CFLAG環境變量

繼續閱讀