tum-vision / lsd_slam

LSD-SLAM
GNU General Public License v3.0
2.58k stars 1.23k forks source link

error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive] Eigen::Map<const g2o::Vector7d> v(m); #313

Open TengFeiHan0 opened 5 years ago

TengFeiHan0 commented 5 years ago

when running LSD-slam on my laptop, I received these unexpected errors

GlobalMapping/g2oTypeSim3Sophus.h:96:20: error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]
   Eigen::Map<const g2o::Vector7d> v(m);
                    ^~~
/home/htf/catkin_ws/src/third_parties/lsd_slam/lsd_slam_core/src/GlobalMapping/g2oTypeSim3Sophus.h:96:33: error: template argument 1 is invalid
   Eigen::Map<const g2o::Vector7d> v(m);
                                 ^
/home/htf/catkin_ws/src/third_parties/lsd_slam/lsd_slam_core/src/GlobalMapping/g2oTypeSim3Sophus.h:96:38: error: invalid conversion from ‘const double*’ to ‘int’ [-fpermissive]
   Eigen::Map<const g2o::Vector7d> v(m);
                                      ^
/home/htf/catkin_ws/src/third_parties/lsd_slam/lsd_slam_core/src/GlobalMapping/g2oTypeSim3Sophus.h:97:38: error: no matching function for call to ‘Sophus::Sim3Group<double>::exp(int&)’
 setMeasurement(Sophus::Sim3d::exp(v));

does anyone has encountered this problem? hope to get some clues, Thank you in advance.

tim37021 commented 5 years ago

Same here g++ 5.4

city22 commented 5 years ago

line 96 @ g2oTypeSim3Sophus.h

Eigen::Map<const g2o::Vector7d> v(m);

change to

Eigen::Map<const Eigen::Matrix<double, 7 ,1> > v(m);

MrMinemeet commented 4 years ago

@city22 's solution worked for me