felixchenfy / Monocular-Visual-Odometry

A simple monocular visual odometry (part of vSLAM) by ORB keypoints with initialization, tracking, local map and bundle adjustment. (WARNING: Hi, I'm sorry that this project is tuned for course demo, not for real world applications !!!)
MIT License
398 stars 91 forks source link

OpenCV 4.x+ requires enabled C++11 support #1

Closed horcham closed 5 years ago

horcham commented 5 years ago

When make, it shows error: #error "OpenCV 4.x+ requires enabled C++11 support", and it seems OpenCV version lower than 3.4.0 can work, but this project recommand OpenCV version higher than 3.4.5. I try to add -DCMAKE_CXX_FLAGS="-std=c++11" but failed. And how to solve the problem above?

felixchenfy commented 5 years ago

Hello, I can't help you with that. It also took me lots of time to get all libraries correct. My CMakeLists.txt is modified from 视觉SLAM十四讲: https://github.com/gaoxiang12/slambook/blob/master/project/0.4/CMakeLists.txt Maybe you can find answers there.

ouyangandy commented 5 years ago

When make, it shows error: #error "OpenCV 4.x+ requires enabled C++11 support", and it seems OpenCV version lower than 3.4.0 can work, but this project recommand OpenCV version higher than 3.4.5. I try to add -DCMAKE_CXX_FLAGS="-std=c++11" but failed. And how to solve the problem above?

如果你使用的是Ubuntu16,需要把作者的CMakeLists.txt中关于std11的那句: # set( CMAKE_CXX_FLAGS "-std=c++11 -O3" ) 改为: add_compile_options(-std=c++11) 如果你使用的是Ubuntu18则不需要做上述更改。我使用的opencv版本为3.4.7