解决Pangolin库安装后出现的C++标准以及链接库问题

安装后,在代码中包含pangolin.h后编译,会出现错误

/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

显然是C++11标准的问题,因此在CMakeLists.txt文件中指定C++11

add_definitions(-std=c++11)

再次编译出现错误

CMakeFiles/plottrajectory.dir/main.cpp.o:(.data+0x0): undefined reference to `vtable for pangolin::Handler'

包含了pangolin库的头文件,而pangolin的一些函数没有定义,说明pangolin没有被链接,在CMakeLists.txt中继续添加


target_link_libraries(plottrajectory pangolin)

再次编译出现错误

/usr/bin/ld: CMakeFiles/plottrajectory.dir/main.cpp.o: undefined reference to symbol 'glTexImage2D'

百度查找到这个东西在OpenGL库中,说明OpenGL库没有被链接

百度查找OpenGL库的头文件,其中一个是gl.h,通过下面指令找到gl.h所在目录是/usr/include/GL

sudo find / -name gl.h

一般目录名对应的就是库名,所以CMakeLists.txt中添加(通过sudo find / -name libGL*命令的确查找到这个库)

target_link_libraries(plottrajectory GL)

再次编译出现错误

/usr/bin/ld: CMakeFiles/plottrajectory.dir/main.cpp.o: undefined reference to symbol '__glewDeleteBuffers'

同样是库没有链接GLEW库的原因,继续添加

target_link_libraries(plottrajectory GLEW)

至此,pangolin库可以正常使用                              

  • 3
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值