ubuntu16.04验证Pangolin安装成功-创新互联

最近在学slam,配环境属实令人头大,每个库安装半天,最后十四讲例程一看还是不能跑,不知道是库没安好还是因为版本不一致或者makefile没写好。

10年积累的网站建设、成都做网站经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先做网站后付款的网站建设流程,更有临河免费网站建设让你可以放心的选择与我们合作。

  所以最近安装后在找例程,先试试每个库是不是安装成功了。

安装前面有:ubuntu16.04安装Pangolin库_浅梦语11的博客-博客

  验证用的是Pangolin自带的例程:Pangolin/examples/HelloPangolin文件夹

  1.终端进入对应文件夹:

cd Pangolin
cd examples/HelloPangolin

2.编译运行一条龙:

cmake .
make
./HelloPangolin

  当然,这是理想情况。如果make环节遇到报错:

/usr/local/include/pangolin/var/varextra.h:68:52:   required from here
/usr/local/include/pangolin/var/varvalue.h:100:23: error: ‘class pangolin::VarValue’ has no member named ‘str’
this->str = (VarValueT*)this;
 ^
/usr/local/include/pangolin/var/varvalue.h:103:23: error: ‘class pangolin::VarValue’ has no member named ‘str’
this->str = str_ptr;
 ^
CMakeFiles/HelloPangolin.dir/build.make:75: recipe for target 'CMakeFiles/HelloPangolin.dir/main.o' failed
make[2]: *** [CMakeFiles/HelloPangolin.dir/main.o] Error 1
CMakeFiles/Makefile2:82: recipe for target 'CMakeFiles/HelloPangolin.dir/all' failed
make[1]: *** [CMakeFiles/HelloPangolin.dir/all] Error 2
Makefile:90: recipe for target 'all' failed
make: *** [all] Error 2


这是CMakeLists.txt出问题了,主要是标准支持等问题,需要加上:

# Check C++11 or C++0x support
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
   add_definitions(-DCOMPILEDWITHC11)
   message(STATUS "Using flag -std=c++11.")
elseif(COMPILER_SUPPORTS_CXX0X)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
   add_definitions(-DCOMPILEDWITHC0X)
   message(STATUS "Using flag -std=c++0x.")
else()
   message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()

最后整个CMakeLists.txt应该是:

# Find Pangolin (https://github.com/stevenlovegrove/Pangolin)
find_package(Pangolin 0.4 REQUIRED)
include_directories(${Pangolin_INCLUDE_DIRS})

add_executable(HelloPangolin main.cpp)
target_link_libraries(HelloPangolin ${Pangolin_LIBRARIES})


# Check C++11 or C++0x support
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
   add_definitions(-DCOMPILEDWITHC11)
   message(STATUS "Using flag -std=c++11.")
elseif(COMPILER_SUPPORTS_CXX0X)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
   add_definitions(-DCOMPILEDWITHC0X)
   message(STATUS "Using flag -std=c++0x.")
else()
   message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()

  很多解决是单纯改set (CMAKE_CXX_STANDARD 11),但是一直不行,这个复杂点但是可以,不行就试试这个吧。

  结果为:

你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧


本文题目:ubuntu16.04验证Pangolin安装成功-创新互联
本文链接:http://pwwzsj.com/article/esoos.html