1.进入CMakeLists.txt中将
set(CMAKE_CXX_FLAGS "-std=c++11")
修改成:
set(CMAKE_CXX_FLAGS "-std=c++14")
若不修改会出现大量报错,如下图:
这个问题通常是由于使用了较旧的编译器或编译器不完全支持 C++14 标准引起的
/usr/local/include/ceres/product_manifold.h:167:50: error: ‘index_sequence’ is not a member of ‘std’
167 | return PlusImpl(x, delta, x_plus_delta, std::index_sequence<Indices...>{});
| ^~~~~~~~~~~~~~
/usr/local/include/ceres/product_manifold.h: In member function ‘bool ceres::ProductManifold<Manifold0, Manifold1, ManifoldN>::MinusImpl(const double*, const double*, double*, int) const’:
/usr/local/include/ceres/product_manifold.h:189:44: error: ‘index_sequence’ is not a member of ‘std’
189 | return MinusImpl(y, x, y_minus_x, std::index_sequence<Indices...>{});
| ^~~~~~~~~~~~~~
/usr/local/include/ceres/product_manifold.h: In member function ‘bool ceres::ProductManifold<Manifold0, Manifold1, ManifoldN>::PlusJacobianImpl(const double*, ceres::MatrixRef&, ceres::internal::FixedArray<double>&, int) const’:
/usr/local/include/ceres/product_manifold.h:217:35: error: ‘index_sequence’ is not a member of ‘std’
217 | x, jacobian, buffer, std::index_sequence<Indices...>{});
| ^~~~~~~~~~~~~~
/usr/local/include/ceres/product_manifold.h: In member function ‘bool ceres::ProductManifold<Manifold0, Manifold1, ManifoldN>::MinusJacobianImpl(const double*, ceres::MatrixRef&, ceres::internal::FixedArray<double>&, int) const’:
/usr/local/include/ceres/product_manifold.h:246:35: error: ‘index_sequence’ is not a member of ‘std’
246 | x, jacobian, buffer, std::index_sequence<Indices...>{});
| ^~~~~~~~~~~~~~
2. 出现
/home/lzd/study_example/kalibr_ws/src/code_utils/src/sumpixel_test.cpp:84:47: error: ‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope
84 | Mat img1 = imread( "/home/gao/IMG_1.png", CV_LOAD_IMAGE_GRAYSCALE );
/home/lzd/study_example/kalibr_ws/src/code_utils/src/sumpixel_test.cpp:94:35: error: ‘CV_MINMAX’ was not declared in this scope; did you mean ‘CV_MMX’?
94 | normalize( img, img2, 0, 255, CV_MINMAX );
| ^~~~~~~~~
| CV_MMX
这样的报错,这些都是由于在 OpenCV 3.x 版本及更高版本中,CV_LOAD_IMAGE_GRAYSCALE
已经被移除,并且被替换为 cv::IMREAD_GRAYSCALE
打开报错信息中的文件,将其中出现的所有
CV_LOAD_IMAGE_GRAYSCALE全部改成 cv::IMREAD_GRAYSCALE;将出现的
CV_LOAD_IMAGE_UNCHANGED全部改成cv::IMREAD_UNCHANGED;将出现的CV_MINMAX改成cv::NORM_MINMAX。