包含Irrlicht静态库时C ++编译错误 [英] C++ compile error when includeing Irrlicht static lib
本文介绍了包含Irrlicht静态库时C ++编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在尝试将Irrlicht静态库包含到我的cmake项目中时,U出现编译错误
U have a compile error when trying to include the Irrlicht static libraries into my cmake project
编译错误:
max@max-MS-7369:~/Desktop/survival/build$ make Scanning dependencies of target survival
[ 33%] Building CXX object src/CMakeFiles/survival.dir/technic.cpp.o
[ 66%] Building CXX object src/CMakeFiles/survival.dir/render.cpp.o
[100%] Building CXX object src/CMakeFiles/survival.dir/survival.cpp.o
Linking CXX executable ../debug/survival
/usr/bin/ld: ../../irrlicht/lib/Linux/libIrrlicht.a(CIrrDeviceLinux.o): undefined reference to symbol 'XConvertSelection'
/usr/bin/ld: note: 'XConvertSelection' is defined in DSO /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libX11.so so try adding it to the linker command line
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libX11.so: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[2]: *** [debug/survival] Error 1
make[1]: *** [src/CMakeFiles/survival.dir/all] Error 2
make: *** [all] Error 2
max@max-MS-7369:~/Desktop/survival/build$
这就是我尝试包含lib的方法:
And this is how I try to include the lib:
# find dependencies for irrlicht
FIND_PACKAGE(ZLIB)
FIND_PACKAGE(X11)
FIND_PACKAGE(OpenGL)
# includes
set( survival_CUSTOM_INCLUDES
${ZLIB_INCLUDE_DIR}
${X11_INCLUDE_DIR}
${OPENGL_INCLUDE_DIR}
${survival_SOURCE_DIR}/irrlicht/include
)
# libraries
set( survival_CUSTOM_LIBRARIES
${ZLIB_LIBRARIES}
${X11_LIBRARIES}
${OPENGL_LIBRARIES}
${survival_SOURCE_DIR}/irrlicht/lib/Linux/libIrrlicht.a
)
即使我已经包含X11库,我也不知道为什么它说找不到XConvertSelection
.
I don't get why it says it cant find XConvertSelection
even though I have included the X11 lib.
推荐答案
我添加了这2个库来对其进行修复
i added those 2 libs to fix it
/usr/lib/x86_64-linux-gnu/libX11.so
/usr/lib/x86_64-linux-gnu/libXxf86vm.so.1
它们不包含在FIND_PACKAGE()提供的库中
they werent included by the libs given from FIND_PACKAGE()
这篇关于包含Irrlicht静态库时C ++编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文