code_utils编译安装过程中的报错

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。

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值