链接问题与pantheios - undefined reference pantheios_init

时间:2013-07-17 16:32:00

标签: c++ gcc linker pantheios

我已经阅读了与此相关的几乎所有帖子。我按照很多地方的建议,两次链接到核心库。我只是无法弄清楚问题是什么。这里的错误是:

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 个答案:

答案 0 :(得分:1)

经过几个小时的浪费时间,我终于在small, inconspicuous post找到了答案。

由于pantheios的构建方式和gcc的工作方式,库需要出现在链接命令中的目标文件后面,如下所示:

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

当我尝试这个时,错误变为未定义的pthread引用,这也很容易通过链接到pthread库来解决。