提前安装engin3
编译ceres时:error: ‘integer_sequence’ is not a member of ‘std‘错误
视觉slam十四讲第六章中,按照上安装的ceres库版本,以及网上大多数教程安装的版本都会和eigen3(3.3.7)有冲突,编译时会报如下错误:
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:64:16: error: ‘integer_sequence’ is not a member of ‘std’ struct SumImpl<std::integer_sequence<T, N, Ns...>> { ^ /usr/local/include/ceres/internal/integer_sequence_algorithm.h:64:16: error: ‘integer_sequence’ is not a member of ‘std’ /usr/local/include/ceres/internal/integer_sequence_algorithm.h:64:46: error: wrong number of template arguments (3, should be 1) struct SumImpl<std::integer_sequence<T, N, Ns...>> { ^ /usr/local/include/ceres/internal/integer_sequence_algorithm.h:60:8: note: provided for ‘template<class Seq> struct ceres::internal::SumImpl’ struct SumImpl; ^ /usr/local/include/ceres/internal/integer_sequence_algorithm.h:64:49: error: expected unqualified-id before ‘>’ token struct SumImpl<std::integer_sequence<T, N, Ns...>> { ^ /usr/local/include/ceres/internal/integer_sequence_algorithm.h:70:16: error: ‘integer_sequence’ is not a member of ‘std’ struct SumImpl<std::integer_sequence<T, N1, N2, Ns...>> { ^ /usr/local/include/ceres/internal/integer_sequence_algorithm.h:70:16: error: ‘integer_sequence’ is not a member of ‘std’ /usr/local/include/ceres/internal/integer_sequence_algorithm.h:70:51: error: wrong number of template arguments (4, should be 1) struct SumImpl<std::integer_sequence<T, N1, N2, Ns...>> { ^ /usr/local/include/ceres/internal/integer_sequence_algorithm.h:60:8: note: provided for ‘template<class Seq> struct ceres::internal::SumImpl’ struct SumImpl; ^ /usr/local/include/ceres/internal/integer_sequence_algorithm.h:70:54: error: expected unqualified-id before ‘>’ token struct SumImpl<std::integer_sequence<T, N1, N2, Ns...>> { ^ /usr/local/include/ceres/internal/integer_sequence_algorithm.h:77:16: error: ‘integer_sequence’ is not a member of ‘std’ struct SumImpl<std::integer_sequence<T, N1, N2, N3, N4, Ns...>> { ^ /usr/local/include/ceres/internal/integer_sequence_algorithm.h:77:16: error: ‘integer_sequence’ is not a member of ‘std’ /usr/local/include/ceres/internal/integer_sequence_algorithm.h:77:59: error: wrong number of template arguments (6, should be 1) struct SumImpl<std::integer_sequence<T, N1, N2, N3, N4, Ns...>> { ^ /usr/local/include/ceres/internal/integer_sequence_algorithm.h:60:8: note: provided for ‘template<class Seq> struct ceres::internal::SumImpl’ struct SumImpl; ^ /usr/local/include/ceres/internal/integer_sequence_algorithm.h:77:62: error: expected unqualified-id before ‘>’ token struct SumImpl<std::integer_sequence<T, N1, N2, N3, N4, Ns...>> { ^ /usr/local/include/ceres/internal/integer_sequence_algorithm.h:84:16: error: ‘integer_sequence’ is not a member of ‘std’ struct SumImpl<std::integer_sequence<T, N>> { ^ /usr/local/include/ceres/internal/integer_sequence_algorithm.h:84:16: error: ‘integer_sequence’ is not a member of ‘std’ /usr/local/include/ceres/internal/integer_sequence_algorithm.h:84:41: error: wrong number of template arguments (2, should be 1) struct SumImpl<std::integer_sequence<T, N>> {
这里换成1.14.0版本的ceres问题得以解决;
1.先删除之前的ceres-solver:
sudo rm -r /usr/local/lib/cmake/Ceres
sudo rm -rf /usr/local/include/ceres /usr/local/lib/libceres.a
sudo rm -r /usr/local/share/Ceres
2.下载ceres-solver-1.14.0
wget ceres-solver.org/ceres-solver-1.14.0.tar.gz
3.解压
tar xvf ceres-solver-1.14.0.tar.gz
4.编译
cd ceres-solver-1.14.0
mkdir build
cd build
cmake ..
make -j4
make test
5.安装
sudo make install
6.编译ceres_curve_fiiting
cd到ceres_curve_fiiting文件夹下
mkdir build
cd build
cmake ..
make
./curve_fitting
成功编译!