我已经阅读了几乎所有与此相关的帖子。正如许多地方所建议的那样,我确实链接到了核心库两次。我就是搞不明白问题出在哪里。下面是错误:
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我真的看不出有什么问题吗?
发布于 2013-07-24 23:02:48
在这个问题上浪费了几个小时之后,我终于在这个small, inconspicuous post中找到了答案。
由于pantheios的构建方式和gcc的工作方式,这些库需要出现在链接命令中的对象文件后面,如下所示:
g++ <compiler flags> <include paths> main.o <other objects> <library paths> <libraries> -o main当我尝试这样做时,错误变成了未定义的pthread引用,这也可以通过链接pthread库轻松地解决。
https://stackoverflow.com/questions/17705362
复制相似问题