1. 连接 eigen库
sudo ln -s /usr/include/eigen3/Eigen /usr/include/Eigen
2. opencvx
修改 CMakeList.txt 中的 find_package open cv版本
修改 include/orbExtracter.h 文件为:
//#include <opencv2/opencv.hpp> #include<opencv2/imgproc/imgproc_c.h> #include <opencv2/highgui/highgui_c.h>
CV_LOAD_IMAGE_UNCHANGED 改为 cv::IMREAD_UNCHANGED
CV_LOAD_IMAGE_GRAYSCALE 改为 cv::IMREAD_GRAYSCALE
CV_LOAD_IMAGE_COLOR 改为 cv::IMREAD_COLOR
CV_LOAD_IMAGE_ANYDEPTH 改为 cv::IMREAD_ANYDEPTH
3. 设置 gcc 编译版本
## 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()
# add this line
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
4. error: ‘usleep’ was not declared in this scope
src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/AR/ViewerAR.h 中添加
#include <unistd.h>
5. 找不到 DBoW2 中的库文件
进入 /home/Cpp_work/ros/src/ORB_SLAM2/Thirdparty/DBoW2 目录,编译 DBoW2
6. error: static assertion failed: std::map must have the same value_type as its allocator
typedef map<KeyFrame*,g2o::Sim3,std::less<KeyFrame*>,
Eigen::aligned_allocator<std::pair<const KeyFrame*, g2o::Sim3> > > KeyFrameAndPose;
改为
typedef map<KeyFrame*,g2o::Sim3,std::less<KeyFrame*>,
Eigen::aligned_allocator<std::pair<KeyFrame* const, g2o::Sim3> > > KeyFrameAndPose;
8. error: ‘std::chrono::monotonic_clock’ has not been declared
add_definitions(-DCOMPILEDWITHC11)
ubuntu20.04 编译orb-slam3踩坑_/usr/local/include/sigslot/signal.hpp:109:79: erro-CSDN博客·
ORB-SLAM2的编译问题_opencv > 2.4.3 not found.-CSDN博客