2013-07-17 63 views
1

我已經閱讀了幾乎所有與此相關的帖子。正如許多地方所建議的那樣,我連接到核心庫兩次。我只是無法弄清楚問題所在。這裏的錯誤:鏈接問題與pantheios - undefined參考pantheios_init

main.o: In function `pantheios_initialiser::pantheios_initialiser()': 
/home/awishformore/code/pantheios/include/pantheios/./internal/initialiser.hpp:119: undefined reference to `pantheios_init' 
/home/awishformore/code/pantheios/include/pantheios/./internal/initialiser.hpp:121: undefined reference to `pantheios_exitProcess' 
main.o: In function `pantheios_initialiser::~pantheios_initialiser()': 
/home/awishformore/code/pantheios/include/pantheios/./internal/initialiser.hpp:133: undefined reference to `pantheios_uninit' 

這是我的makefile生成鏈接線:

g++ -Wall -g -I/home/awishformore/code/stlsoft/include -I/home/awishformore/code/pantheios/include -I/home/awishformore/code/boost_1_54_0 -I/home/awishformore/code/mysql/include -L/home/awishformore/code/pantheios/lib -L/home/awishformore/code/mysql/lib -L/home/awishformore/code/boost_1_54_0/lib -lpantheios.1.core.gcc46.file64bit.mt -lpantheios.1.fe.simple.gcc46.file64bit.mt -lpantheios.1.be.fprintf.gcc46.file64bit.mt -lpantheios.1.bec.fprintf.gcc46.file64bit.mt -lpantheios.1.core.gcc46.file64bit.mt -lpantheios.1.util.gcc46.file64bit.mt main.o Database.o -o engine 

我實在看不出有什麼錯呢?

回答

1

經過幾小時和幾個小時的浪費,我終於在這個small, inconspicuous post找到了答案。

由於道路pantheios是建立和方式GCC工程,圖書館需要出現在鏈接命令中的目標文件後面,如下所示:

g++ <compiler flags> <include paths> main.o <other objects> <library paths> <libraries> -o main 

當我試過了,錯誤改爲未定義的pthread引用,這也很容易通過鏈接到pthread庫來解決。

+0

哦,天啊,感謝這篇文章。我很高興我不必去找那個小而不顯眼的帖子,而是在這裏寄宿你的快樂答案! –