davidskdds / DMSA_LiDAR_SLAM

LiDAR Inertial Mapping Package
MIT License
137 stars 15 forks source link

Compiler Error #4

Closed jiawenquan closed 3 months ago

jiawenquan commented 3 months ago

In file included from /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/ConsecutivePoses.h:12, from /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/ContinuousTrajectory.h:13, from /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/DmsaSlam.h:18, from /catkin_ws/src/DMSA_LiDAR_SLAM/include/dmsa_slam_ros.h:13, from /catkin_ws/src/DMSA_LiDAR_SLAM/src/main.cpp:16: /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h: In member function ‘void Poses::getParamsAsVector(Eigen::VectorXd&)’: /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h:68:72: error: ‘Eigen::DenseBase<Eigen::Matrix<double, 3, -1> >::BlockXpr’ {aka ‘class Eigen::Block<Eigen::Matrix<double, 3, -1>, -1, -1, false>’} has no member named ‘reshaped’ 68 | params << Orientations.block(0, 1, 3, Orientations.cols() - 1).reshaped(Orientations.cols() Orientations.rows() - 3, 1), | ^~~~ In file included from /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/ConsecutivePoses.h:12, from /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/ContinuousTrajectory.h:13, from /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/DmsaSlam.h:18, from /catkin_ws/src/DMSA_LiDAR_SLAM/include/dmsa_slam_ros.h:13, from /catkin_ws/src/DMSA_LiDAR_SLAM/src/main.cpp:16: /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h:69:66: error: ‘Eigen::DenseBase<Eigen::Matrix<double, 3, -1> >::BlockXpr’ {aka ‘class Eigen::Block<Eigen::Matrix<double, 3, -1>, -1, -1, false>’} has no member named ‘reshaped’ 69 | Translations.block(0, 1, 3, Translations.cols() - 1).reshaped(Translations.cols() Translations.rows() - 3, 1); | ^~~~ /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h: In member function ‘void Poses::setParamsFromVector(const VectorXd&)’: /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h:74:123: error: ‘Eigen::DenseBase<Eigen::Matrix<double, -1, 1> >::ConstSegmentReturnType’ {aka ‘const class Eigen::VectorBlock<const Eigen::Matrix<double, -1, 1>, -1>’} has no member named ‘reshaped’ 74 | 3, Orientations.cols() - 1) = params.head(Orientations.cols() * Orientations.rows() - 3).reshaped(Orientations.rows(), Orientations.cols() - 1); | ^~~~

/catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h:75:123: error: ‘Eigen::DenseBase<Eigen::Matrix<double, -1, 1> >::ConstSegmentReturnType’ {aka ‘const class Eigen::VectorBlock<const Eigen::Matrix<double, -1, 1>, -1>’} has no member named ‘reshaped’ 75 | 3, Translations.cols() - 1) = params.tail(Translations.cols() * Translations.rows() - 3).reshaped(Translations.rows(), Translations.cols() - 1); | ^~~~

/catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h: In member function ‘void Poses::getTranslationParamsAsVector(Eigen::VectorXd&)’: /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h:82:72: error: ‘Eigen::DenseBase<Eigen::Matrix<double, 3, -1> >::BlockXpr’ {aka ‘class Eigen::Block<Eigen::Matrix<double, 3, -1>, -1, -1, false>’} has no member named ‘reshaped’ 82 | params << Translations.block(0, 1, 3, Translations.cols() - 1).reshaped(Translations.cols() Translations.rows() - 3, 1); | ^~~~ /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h: In member function ‘void Poses::setTranslationParamsFromVector(const VectorXd&)’: /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h:87:72: error: ‘const VectorXd’ {aka ‘const class Eigen::Matrix<double, -1, 1>’} has no member named ‘reshaped’ 87 | Translations.block(0, 1, 3, Translations.cols() - 1) = params.reshaped(Translations.rows(), Translations.cols() - 1); | ^~~~ /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h: In member function ‘void Poses::getParamsAsVectorFull(Eigen::VectorXd&)’: /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h:94:68: error: ‘Eigen::DenseBase<Eigen::Matrix<double, 3, -1> >::BlockXpr’ {aka ‘class Eigen::Block<Eigen::Matrix<double, 3, -1>, -1, -1, false>’} has no member named ‘reshaped’ 94 | params << Orientations.block(0, 0, 3, Orientations.cols()).reshaped(Orientations.cols() Orientations.rows(), 1), | ^~~~ /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h:95:62: error: ‘Eigen::DenseBase<Eigen::Matrix<double, 3, -1> >::BlockXpr’ {aka ‘class Eigen::Block<Eigen::Matrix<double, 3, -1>, -1, -1, false>’} has no member named ‘reshaped’ 95 | Translations.block(0, 0, 3, Translations.cols()).reshaped(Translations.cols() Translations.rows(), 1); | ^~~~ /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h: In member function ‘void Poses::setParamsFromVectorFull(const VectorXd&)’: /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h:100:115: error: ‘Eigen::DenseBase<Eigen::Matrix<double, -1, 1> >::ConstSegmentReturnType’ {aka ‘const class Eigen::VectorBlock<const Eigen::Matrix<double, -1, 1>, -1>’} has no member named ‘reshaped’ 100 | ck(0, 0, 3, Orientations.cols()) = params.head(Orientations.cols() Orientations.rows()).reshaped(Orientations.rows(), Orientations.cols()); | ^~~~

/catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h:101:115: error: ‘Eigen::DenseBase<Eigen::Matrix<double, -1, 1> >::ConstSegmentReturnType’ {aka ‘const class Eigen::VectorBlock<const Eigen::Matrix<double, -1, 1>, -1>’} has no member named ‘reshaped’ 101 | ck(0, 0, 3, Translations.cols()) = params.tail(Translations.cols() * Translations.rows()).reshaped(Translations.rows(), Translations.cols()); | ^~~~

In file included from /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/ConsecutivePoses.h:12, from /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/ContinuousTrajectory.h:13, from /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/DmsaSlam.h:18, from /catkin_ws/src/DMSA_LiDAR_SLAM/include/dmsa_slam_ros.h:13, from /catkin_ws/src/DMSA_LiDAR_SLAM/src/dmsa_slam_ros.cpp:9: /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h: In member function ‘void Poses::getParamsAsVector(Eigen::VectorXd&)’: /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h:68:72: error: ‘Eigen::DenseBase<Eigen::Matrix<double, 3, -1> >::BlockXpr’ {aka ‘class Eigen::Block<Eigen::Matrix<double, 3, -1>, -1, -1, false>’} has no member named ‘reshaped’ 68 | params << Orientations.block(0, 1, 3, Orientations.cols() - 1).reshaped(Orientations.cols() Orientations.rows() - 3, 1), | ^~~~ In file included from /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/ConsecutivePoses.h:12, from /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/ContinuousTrajectory.h:13, from /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/DmsaSlam.h:18, from /catkin_ws/src/DMSA_LiDAR_SLAM/include/dmsa_slam_ros.h:13, from /catkin_ws/src/DMSA_LiDAR_SLAM/src/dmsa_slam_ros.cpp:9: /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h:69:66: error: ‘Eigen::DenseBase<Eigen::Matrix<double, 3, -1> >::BlockXpr’ {aka ‘class Eigen::Block<Eigen::Matrix<double, 3, -1>, -1, -1, false>’} has no member named ‘reshaped’ 69 | Translations.block(0, 1, 3, Translations.cols() - 1).reshaped(Translations.cols() Translations.rows() - 3, 1); | ^~~~ /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h: In member function ‘void Poses::setParamsFromVector(const VectorXd&)’: /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h:74:123: error: ‘Eigen::DenseBase<Eigen::Matrix<double, -1, 1> >::ConstSegmentReturnType’ {aka ‘const class Eigen::VectorBlock<const Eigen::Matrix<double, -1, 1>, -1>’} has no member named ‘reshaped’ 74 | Orientations.block(0, 1, 3, Orientations.cols() - 1) = params.head(Orientations.cols() Orientations.rows() - 3).reshaped(Orientations.rows(), Orientations.cols() - 1); | ^~~~ /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h:75:123: error: ‘Eigen::DenseBase<Eigen::Matrix<double, -1, 1> >::ConstSegmentReturnType’ {aka ‘const class Eigen::VectorBlock<const Eigen::Matrix<double, -1, 1>, -1>’} has no member named ‘reshaped’ 75 | Translations.block(0, 1, 3, Translations.cols() - 1) = params.tail(Translations.cols() Translations.rows() - 3).reshaped(Translations.rows(), Translations.cols() - 1); | ^~~~ /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h: In member function ‘void Poses::getTranslationParamsAsVector(Eigen::VectorXd&)’: /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h:82:72: error: ‘Eigen::DenseBase<Eigen::Matrix<double, 3, -1> >::BlockXpr’ {aka ‘class Eigen::Block<Eigen::Matrix<double, 3, -1>, -1, -1, false>’} has no member named ‘reshaped’ 82 | params << Translations.block(0, 1, 3, Translations.cols() - 1).reshaped(Translations.cols() Translations.rows() - 3, 1); | ^~~~ /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h: In member function ‘void Poses::setTranslationParamsFromVector(const VectorXd&)’: /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h:87:72: error: ‘const VectorXd’ {aka ‘const class Eigen::Matrix<double, -1, 1>’} has no member named ‘reshaped’ 87 | Translations.block(0, 1, 3, Translations.cols() - 1) = params.reshaped(Translations.rows(), Translations.cols() - 1); | ^~~~ /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h: In member function ‘void Poses::getParamsAsVectorFull(Eigen::VectorXd&)’: /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h:94:68: error: ‘Eigen::DenseBase<Eigen::Matrix<double, 3, -1> >::BlockXpr’ {aka ‘class Eigen::Block<Eigen::Matrix<double, 3, -1>, -1, -1, false>’} has no member named ‘reshaped’ 94 | params << Orientations.block(0, 0, 3, Orientations.cols()).reshaped(Orientations.cols() Orientations.rows(), 1), | ^~~~ /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h:95:62: error: ‘Eigen::DenseBase<Eigen::Matrix<double, 3, -1> >::BlockXpr’ {aka ‘class Eigen::Block<Eigen::Matrix<double, 3, -1>, -1, -1, false>’} has no member named ‘reshaped’ 95 | Translations.block(0, 0, 3, Translations.cols()).reshaped(Translations.cols() Translations.rows(), 1); | ^~~~ /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h: In member function ‘void Poses::setParamsFromVectorFull(const VectorXd&)’: /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h:100:115: error: ‘Eigen::DenseBase<Eigen::Matrix<double, -1, 1> >::ConstSegmentReturnType’ {aka ‘const class Eigen::VectorBlock<const Eigen::Matrix<double, -1, 1>, -1>’} has no member named ‘reshaped’ 100 | Orientations.block(0, 0, 3, Orientations.cols()) = params.head(Orientations.cols() Orientations.rows()).reshaped(Orientations.rows(), Orientations.cols()); | ^~~~ /catkin_ws/src/DMSA_LiDAR_SLAM/include/DMSA/Poses.h:101:115: error: ‘Eigen::DenseBase<Eigen::Matrix<double, -1, 1> >::ConstSegmentReturnType’ {aka ‘const class Eigen::VectorBlock<const Eigen::Matrix<double, -1, 1>, -1>’} has no member named ‘reshaped’ 101 | Translations.block(0, 0, 3, Translations.cols()) = params.tail(Translations.cols() * Translations.rows()).reshaped(Translations.rows(), Translations.cols()); | ^~~~ make[2]: [DMSA_LiDAR_SLAM/CMakeFiles/dmsa_slam_ros.dir/build.make:63:DMSA_LiDAR_SLAM/CMakeFiles/dmsa_slam_ros.dir/src/main.cpp.o] 错误 1 make[2]: 正在等待未完成的任务.... make[2]: [DMSA_LiDAR_SLAM/CMakeFiles/dmsa_slam_ros.dir/build.make:76:DMSA_LiDAR_SLAM/CMakeFiles/dmsa_slam_ros.dir/src/dmsa_slam_ros.cpp.o] 错误 1 make[1]: [CMakeFiles/Makefile2:463:DMSA_LiDAR_SLAM/CMakeFiles/dmsa_slam_ros.dir/all] 错误 2 make: *** [Makefile:141:all] 错误 2 Invoking "make -j8 -l8" failed

jiawenquan commented 3 months ago

I have made the following modifications using locally compiled eigen-3.4.0 find_package(Eigen3 REQUIRED PATHS /home/wenquan/eigen-3.4.0)

davidskdds commented 3 months ago

Hello @jiawenquan , thank you for your interest in this software package. It's not easy for me to fix this compiler error while having a different Eigen configuration on my computer, but I did a little searching.

I asked ChatGPT about your line "find_package(Eigen3 REQUIRED PATHS /home/wenquan/eigen-3.4.0)" and it wrote that "HINTS" instead of your PATH argument should work better. Maybe you can try this: find_package(Eigen3 REQUIRED HINTS /home/wenquan/eigen-3.4.0)

The explination was: "The difference is that HINTS suggests directories where CMake should search first, while PATHS is more about providing additional paths. Using HINTS is generally the preferred method for suggesting the location of a package."

If this is correct, your compiler is using an older Eigen version that has been found by CMake in advance. That would explain your compile error.

Another way to fix this would be to update your Eigen library in your /include directory using the provided script: sh helpers/updateEigenUbuntu20.04.sh

Let me know, if you were able to fix it.

Best regards David

jiawenquan commented 3 months ago

Thank you so much, it solved the compilation error.