librdf 编译错误,未定义引用 raptor_new_world_internal'

librdf compiling error, undefined reference to raptor_new_world_internal'

我安装raptor(librdf.org)成功后,我运行g++ test.cpp编译。但是得到 raptor2.h: No such file or directory.

所以我将 /usr/include/raptor2/raptor2.h 复制到 /usr/include/raptor2.h,并且消除了上面的错误。但是出现了新的错误:undefined reference to `raptor_new_world_internal'.

谁能告诉我哪里出了问题,谢谢。环境:ubuntu12.04.

不要复制头文件,尝试

#include <raptor2/raptor2.h>

并用g++ test.cpp -lraptor2编译。您需要 link 反对库才能使用它。