gaoxiang12 / slambook2

edition 2 of the slambook
MIT License
5.54k stars 2.02k forks source link

高老師您好 直接在ch5文件夾裏面 新建build 然後進入 cmake .. ;make 回報很長的錯誤 #49

Open Zhongwei-Luo opened 4 years ago

Zhongwei-Luo commented 4 years ago

lzw@lzw:~/learn_slam/bookcode2/ch5/build$ cmake .. -- The C compiler identification is GNU 5.4.0 -- The CXX compiler identification is GNU 5.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found OpenCV: /opt/ros/kinetic (found version "3.3.1") -- Configuring done -- Generating done -- Build files have been written to: /home/lzw/learn_slam/bookcode2/ch5/build lzw@lzw:~/learn_slam/bookcode2/ch5/build$ make Scanning dependencies of target undistortImage [ 12%] Building CXX object imageBasics/CMakeFiles/undistortImage.dir/undistortImage.cpp.o [ 25%] Linking CXX executable undistortImage [ 25%] Built target undistortImage Scanning dependencies of target imageBasics [ 37%] Building CXX object imageBasics/CMakeFiles/imageBasics.dir/imageBasics.cpp.o [ 50%] Linking CXX executable imageBasics [ 50%] Built target imageBasics Scanning dependencies of target stereoVision [ 62%] Building CXX object stereo/CMakeFiles/stereoVision.dir/stereoVision.cpp.o [ 75%] Linking CXX executable stereoVision [ 75%] Built target stereoVision Scanning dependencies of target joinMap [ 87%] Building CXX object rgbd/CMakeFiles/joinMap.dir/joinMap.cpp.o In file included from /usr/local/include/sophus/so3.hpp:8:0, from /usr/local/include/sophus/se3.hpp:7, from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:5: /usr/local/include/sophus/so2.hpp:106:40: error: ‘ScalarBinaryOpTraits’ in namespace ‘Eigen’ does not name a template type using ReturnScalar = typename Eigen::ScalarBinaryOpTraits< ^ /usr/local/include/sophus/so2.hpp:110:26: error: ‘ReturnScalar’ was not declared in this scope using SO2Product = SO2<ReturnScalar>; ^ /usr/local/include/sophus/so2.hpp:110:39: error: template argument 1 is invalid using SO2Product = SO2<ReturnScalar>; ^ /usr/local/include/sophus/so2.hpp:113:32: error: ‘ReturnScalar’ was not declared in this scope using PointProduct = Vector2<ReturnScalar>; ^ /usr/local/include/sophus/so2.hpp:113:45: error: template argument 1 is invalid using PointProduct = Vector2<ReturnScalar>; ^ /usr/local/include/sophus/so2.hpp:116:43: error: ‘ReturnScalar’ was not declared in this scope using HomogeneousPointProduct = Vector3<ReturnScalar>; ^ /usr/local/include/sophus/so2.hpp:116:56: error: template argument 1 is invalid using HomogeneousPointProduct = Vector3<ReturnScalar>; ^ /usr/local/include/sophus/so2.hpp:214:15: error: ‘SO2Product’ does not name a type SOPHUS_FUNC SO2Product operator( ^ /usr/local/include/sophus/so2.hpp:249:15: error: ‘PointProduct’ does not name a type SOPHUS_FUNC PointProduct operator( ^ /usr/local/include/sophus/so2.hpp:265:15: error: ‘HomogeneousPointProduct’ does not name a type SOPHUS_FUNC HomogeneousPointProduct operator( ^ /usr/local/include/sophus/so2.hpp:289:38: error: ‘ReturnScalar’ was not declared in this scope std::is_same<Scalar, ReturnScalar>::value>::type> ^ /usr/local/include/sophus/so2.hpp:289:51: error: template argument 2 is invalid std::is_same<Scalar, ReturnScalar>::value>::type> ^ /usr/local/include/sophus/so2.hpp:289:63: error: template argument 1 is invalid std::is_same<Scalar, ReturnScalar>::value>::type> ^ /usr/local/include/sophus/so2.hpp:289:75: error: ‘type’ in namespace ‘::’ does not name a type std::is_same<Scalar, ReturnScalar>::value>::type> ^ In file included from /usr/local/include/sophus/se3.hpp:7:0, from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:5: /usr/local/include/sophus/so3.hpp:110:40: error: ‘ScalarBinaryOpTraits’ in namespace ‘Eigen’ does not name a template type using ReturnScalar = typename Eigen::ScalarBinaryOpTraits< ^ /usr/local/include/sophus/so3.hpp:114:26: error: ‘ReturnScalar’ was not declared in this scope using SO3Product = SO3<ReturnScalar>; ^ /usr/local/include/sophus/so3.hpp:114:39: error: template argument 1 is invalid using SO3Product = SO3<ReturnScalar>; ^ /usr/local/include/sophus/so3.hpp:117:32: error: ‘ReturnScalar’ was not declared in this scope using PointProduct = Vector3<ReturnScalar>; ^ /usr/local/include/sophus/so3.hpp:117:45: error: template argument 1 is invalid using PointProduct = Vector3<ReturnScalar>; ^ /usr/local/include/sophus/so3.hpp:120:43: error: ‘ReturnScalar’ was not declared in this scope using HomogeneousPointProduct = Vector4<ReturnScalar>; ^ /usr/local/include/sophus/so3.hpp:120:56: error: template argument 1 is invalid using HomogeneousPointProduct = Vector4<ReturnScalar>; ^ /usr/local/include/sophus/so3.hpp:329:15: error: ‘SO3Product’ does not name a type SOPHUS_FUNC SO3Product operator( ^ /usr/local/include/sophus/so3.hpp:362:15: error: ‘PointProduct’ does not name a type SOPHUS_FUNC PointProduct operator( ^ /usr/local/include/sophus/so3.hpp:377:15: error: ‘HomogeneousPointProduct’ does not name a type SOPHUS_FUNC HomogeneousPointProduct operator( ^ /usr/local/include/sophus/so3.hpp:399:38: error: ‘ReturnScalar’ was not declared in this scope std::is_same<Scalar, ReturnScalar>::value>::type> ^ /usr/local/include/sophus/so3.hpp:399:51: error: template argument 2 is invalid std::is_same<Scalar, ReturnScalar>::value>::type> ^ /usr/local/include/sophus/so3.hpp:399:63: error: template argument 1 is invalid std::is_same<Scalar, ReturnScalar>::value>::type> ^ /usr/local/include/sophus/so3.hpp:399:75: error: ‘type’ in namespace ‘::’ does not name a type std::is_same<Scalar, ReturnScalar>::value>::type> ^ In file included from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:5:0: /usr/local/include/sophus/se3.hpp:85:40: error: ‘ScalarBinaryOpTraits’ in namespace ‘Eigen’ does not name a template type using ReturnScalar = typename Eigen::ScalarBinaryOpTraits< ^ /usr/local/include/sophus/se3.hpp:89:26: error: ‘ReturnScalar’ was not declared in this scope using SE3Product = SE3<ReturnScalar>; ^ /usr/local/include/sophus/se3.hpp:89:39: error: template argument 1 is invalid using SE3Product = SE3<ReturnScalar>; ^ /usr/local/include/sophus/se3.hpp:92:32: error: ‘ReturnScalar’ was not declared in this scope using PointProduct = Vector3<ReturnScalar>; ^ /usr/local/include/sophus/se3.hpp:92:45: error: template argument 1 is invalid using PointProduct = Vector3<ReturnScalar>; ^ /usr/local/include/sophus/se3.hpp:95:43: error: ‘ReturnScalar’ was not declared in this scope using HomogeneousPointProduct = Vector4<ReturnScalar>; ^ /usr/local/include/sophus/se3.hpp:95:56: error: template argument 1 is invalid using HomogeneousPointProduct = Vector4<ReturnScalar>; ^ /usr/local/include/sophus/se3.hpp:308:15: error: ‘SE3Product’ does not name a type SOPHUS_FUNC SE3Product operator( ^ /usr/local/include/sophus/se3.hpp:325:15: error: ‘PointProduct’ does not name a type SOPHUS_FUNC PointProduct operator( ^ /usr/local/include/sophus/se3.hpp:335:15: error: ‘HomogeneousPointProduct’ does not name a type SOPHUS_FUNC HomogeneousPointProduct operator*( ^ /usr/local/include/sophus/se3.hpp:359:38: error: ‘ReturnScalar’ was not declared in this scope std::is_same<Scalar, ReturnScalar>::value>::type> ^ /usr/local/include/sophus/se3.hpp:359:51: error: template argument 2 is invalid std::is_same<Scalar, ReturnScalar>::value>::type> ^ /usr/local/include/sophus/se3.hpp:359:63: error: template argument 1 is invalid std::is_same<Scalar, ReturnScalar>::value>::type> ^ /usr/local/include/sophus/se3.hpp:359:75: error: ‘type’ in namespace ‘::’ does not name a type std::is_same<Scalar, ReturnScalar>::value>::type> ^ /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp: In function ‘int main(int, char)’: /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:62:48: error: no match for ‘operator’ (operand types are ‘Sophus::SE3d {aka Sophus::SE3}’ and ‘Eigen::Vector3d {aka Eigen::Matrix<double, 3, 1>}’) Eigen::Vector3d pointWorld = T point; ^ In file included from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:5:0: /usr/local/include/sophus/se3.hpp:350:20: note: candidate: Sophus::SE3Base::Line Sophus::SE3Base::operator(const Line&) const [with Derived = Sophus::SE3; Sophus::SE3Base::Line = Eigen::ParametrizedLine<double, 3, 0>; typename Eigen::internal::traits::Scalar = double] SOPHUS_FUNC Line operator(Line const& l) const { ^ /usr/local/include/sophus/se3.hpp:350:20: note: no known conversion for argument 1 from ‘Eigen::Vector3d {aka Eigen::Matrix<double, 3, 1>}’ to ‘const Line& {aka const Eigen::ParametrizedLine<double, 3, 0>&}’ In file included from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/core/cvstd.inl.hpp:47:0, from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/core.hpp:3281, from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/opencv.hpp:52, from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:3: /usr/include/c++/5/complex:386:5: note: candidate: template std::complex<_Tp> std::operator(const std::complex<_Tp>&, const std::complex<_Tp>&) operator(const complex<_Tp>& x, const complex<_Tp>& y) ^ /usr/include/c++/5/complex:386:5: note: template argument deduction/substitution failed: /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:62:50: note: ‘Sophus::SE3d {aka Sophus::SE3}’ is not derived from ‘const std::complex<_Tp>’ Eigen::Vector3d pointWorld = T point; ^ In file included from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/core/cvstd.inl.hpp:47:0, from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/core.hpp:3281, from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/opencv.hpp:52, from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:3: /usr/include/c++/5/complex:395:5: note: candidate: template std::complex<_Tp> std::operator(const std::complex<_Tp>&, const _Tp&) operator*(const complex<_Tp>& x, const _Tp& y) ^ /usr/include/c++/5/complex:395:5: note: template argument deduction/substitution failed: /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:62:50: note: ‘Sophus::SE3d {aka Sophus::SE3}’ is not derived from ‘const std::complex<_Tp>’ Eigen::Vector3d pointWorld = T point; ^ In file included from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/core/cvstd.inl.hpp:47:0, from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/core.hpp:3281, from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/opencv.hpp:52, from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:3: /usr/include/c++/5/complex:404:5: note: candidate: template std::complex<_Tp> std::operator(const _Tp&, const std::complex<_Tp>&) operator(const _Tp& __x, const complex<_Tp>& __y) ^ /usr/include/c++/5/complex:404:5: note: template argument deduction/substitution failed: /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:62:50: note: ‘Eigen::Vector3d {aka Eigen::Matrix<double, 3, 1>}’ is not derived from ‘const std::complex<_Tp>’ Eigen::Vector3d pointWorld = T point; ^ In file included from /usr/include/eigen3/Eigen/Householder:24:0, from /usr/include/eigen3/Eigen/QR:17, from /usr/include/eigen3/Eigen/Dense:4, from /usr/local/include/sophus/rotation_matrix.hpp:7, from /usr/local/include/sophus/so3.hpp:7, from /usr/local/include/sophus/se3.hpp:7, from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:5: /usr/include/eigen3/Eigen/src/Householder/HouseholderSequence.h:439:99: note: candidate: template<class OtherDerived, class VectorsType, class CoeffsType, int Side> typename Eigen::internal::matrix_type_times_scalar_type<typename VectorsType::Scalar, OtherDerived>::Type Eigen::operator(const Eigen::MatrixBase&, const Eigen::HouseholderSequence<VectorsType, CoeffsType, Side>&) _times_scalar_type<typename VectorsType::Scalar,OtherDerived>::Type operator(c ^ /usr/include/eigen3/Eigen/src/Householder/HouseholderSequence.h:439:99: note: template argument deduction/substitution failed: /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:62:50: note: ‘Sophus::SE3d {aka Sophus::SE3}’ is not derived from ‘const Eigen::MatrixBase’ Eigen::Vector3d pointWorld = T point; ^ In file included from /usr/include/eigen3/Eigen/Core:397:0, from /usr/include/eigen3/Eigen/Dense:1, from /usr/local/include/sophus/rotation_matrix.hpp:7, from /usr/local/include/sophus/so3.hpp:7, from /usr/local/include/sophus/se3.hpp:7, from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:5: /usr/include/eigen3/Eigen/src/Core/Transpositions.h:350:1: note: candidate: template<class TranspositionsDerived, class MatrixDerived> const Eigen::Product<MatrixDerived, PermutationDerived, 2> Eigen::operator(const Eigen::TranspositionsBase&, const Eigen::MatrixBase&) operator(const TranspositionsBase &transpositions, ^ /usr/include/eigen3/Eigen/src/Core/Transpositions.h:350:1: note: template argument deduction/substitution failed: /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:62:50: note: ‘Sophus::SE3d {aka Sophus::SE3}’ is not derived from ‘const Eigen::TranspositionsBase’ Eigen::Vector3d pointWorld = T point; ^ In file included from /usr/include/eigen3/Eigen/Core:397:0, from /usr/include/eigen3/Eigen/Dense:1, from /usr/local/include/sophus/rotation_matrix.hpp:7, from /usr/local/include/sophus/so3.hpp:7, from /usr/local/include/sophus/se3.hpp:7, from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:5: /usr/include/eigen3/Eigen/src/Core/Transpositions.h:338:1: note: candidate: template<class MatrixDerived, class TranspositionsDerived> const Eigen::Product<MatrixDerived, PermutationDerived, 2> Eigen::operator(const Eigen::MatrixBase&, const Eigen::TranspositionsBase&) operator(const MatrixBase &matrix, ^ /usr/include/eigen3/Eigen/src/Core/Transpositions.h:338:1: note: template argument deduction/substitution failed: /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:62:50: note: ‘Sophus::SE3d {aka Sophus::SE3}’ is not derived from ‘const Eigen::MatrixBase’ Eigen::Vector3d pointWorld = T point; ^ In file included from /usr/include/eigen3/Eigen/Core:396:0, from /usr/include/eigen3/Eigen/Dense:1, from /usr/local/include/sophus/rotation_matrix.hpp:7, from /usr/local/include/sophus/so3.hpp:7, from /usr/local/include/sophus/se3.hpp:7, from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:5: /usr/include/eigen3/Eigen/src/Core/PermutationMatrix.h:558:1: note: candidate: template<class PermutationDerived, class MatrixDerived> const Eigen::Product<MatrixDerived, PermutationDerived, 2> Eigen::operator(const Eigen::PermutationBase&, const Eigen::MatrixBase&) operator(const PermutationBase &permutation, ^ /usr/include/eigen3/Eigen/src/Core/PermutationMatrix.h:558:1: note: template argument deduction/substitution failed: /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:62:50: note: ‘Sophus::SE3d {aka Sophus::SE3}’ is not derived from ‘const Eigen::PermutationBase’ Eigen::Vector3d pointWorld = T point; ^ In file included from /usr/include/eigen3/Eigen/Core:396:0, from /usr/include/eigen3/Eigen/Dense:1, from /usr/local/include/sophus/rotation_matrix.hpp:7, from /usr/local/include/sophus/so3.hpp:7, from /usr/local/include/sophus/se3.hpp:7, from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:5: /usr/include/eigen3/Eigen/src/Core/PermutationMatrix.h:546:1: note: candidate: template<class MatrixDerived, class PermutationDerived> const Eigen::Product<MatrixDerived, PermutationDerived, 2> Eigen::operator(const Eigen::MatrixBase&, const Eigen::PermutationBase&) operator(const MatrixBase &matrix, ^ /usr/include/eigen3/Eigen/src/Core/PermutationMatrix.h:546:1: note: template argument deduction/substitution failed: /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:62:50: note: ‘Sophus::SE3d {aka Sophus::SE3}’ is not derived from ‘const Eigen::MatrixBase’ Eigen::Vector3d pointWorld = T point; ^ In file included from /usr/include/eigen3/Eigen/src/Core/MatrixBase.h:126:0, from /usr/include/eigen3/Eigen/Core:345, from /usr/include/eigen3/Eigen/Dense:1, from /usr/local/include/sophus/rotation_matrix.hpp:7, from /usr/local/include/sophus/so3.hpp:7, from /usr/local/include/sophus/se3.hpp:7, from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:5: /usr/include/eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h:88:1: note: candidate: const Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple2_op<double, std::complex >, const Eigen::Matrix<double, 3, 1> > Eigen::operator(const std::complex&, const StorageBaseType&) operator(const std::complex& scalar, const StorageBaseType& matrix) ^ /usr/include/eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h:88:1: note: no known conversion for argument 1 from ‘Sophus::SE3d {aka Sophus::SE3}’ to ‘const std::complex&’ /usr/include/eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h:83:1: note: candidate: const ScalarMultipleReturnType Eigen::operator(const Scalar&, const StorageBaseType&) operator*(const Scalar& scalar, const StorageBaseType& matrix) ^ /usr/include/eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h:83:1: note: no known conversion for argument 1 from ‘Sophus::SE3d {aka Sophus::SE3}’ to ‘const Scalar& {aka const double&}’ rgbd/CMakeFiles/joinMap.dir/build.make:62: recipe for target 'rgbd/CMakeFiles/joinMap.dir/joinMap.cpp.o' failed make[2]: ** [rgbd/CMakeFiles/joinMap.dir/joinMap.cpp.o] Error 1 CMakeFiles/Makefile2:234: recipe for target 'rgbd/CMakeFiles/joinMap.dir/all' failed make[1]: [rgbd/CMakeFiles/joinMap.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2

Deskunn commented 4 years ago

问题解决了吗?

Zhongwei-Luo commented 4 years ago

问题解决了吗? 您好,我没有解决这个问题

NodYoung commented 4 years ago

编译Sophus时:

  1. git checkout 13fb3288311485dc94e3226b69c9b59cd06ff94e
  2. 在cmakelist里option(BUILD_TESTS "Build tests." OFF)
LT-ZHONG commented 4 years ago

@NodYoung 我在 git checkout 13fb3288311485dc94e3226b69c9b59cd06ff94e 的时候,报错了,错误信息如下 fatal: reference is not a tree: 13fb3288311485dc94e3226b69c9b59cd06ff94e

cggos commented 3 years ago

add the code below and it works for me when using the latest sophus

find_package(Eigen3 REQUIRED) # v3.3.7
include_directories(${EIGEN3_INCLUDE_DIR})