跟着高博的SLAM视频学习时,在安装编译Sophus时提示:
`usr/bin/cmake -H/home/drew/svo/workspace/Sophus -B/home/drew/svo/workspace/Sophus/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/drew/svo/workspace/Sophus/build/CMakeFiles /home/drew/svo/workspace/Sophus/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/drew/svo/workspace/Sophus/build'
make -f CMakeFiles/Sophus.dir/build.make CMakeFiles/Sophus.dir/depend
make[2]: Entering directory '/home/drew/svo/workspace/Sophus/build'
cd /home/drew/svo/workspace/Sophus/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/drew/svo/workspace/Sophus /home/drew/svo/workspace/Sophus /home/drew/svo/workspace/Sophus/build /home/drew/svo/workspace/Sophus/build /home/drew/svo/workspace/Sophus/build/CMakeFiles/Sophus.dir/DependInfo.cmake --color=
Scanning dependencies of target Sophus
make[2]: Leaving directory '/home/drew/svo/workspace/Sophus/build'
make -f CMakeFiles/Sophus.dir/build.make CMakeFiles/Sophus.dir/build
make[2]: Entering directory '/home/drew/svo/workspace/Sophus/build'
[ 5%] Building CXX object CMakeFiles/Sophus.dir/sophus/so2.cpp.o
/usr/bin/c++ -DSophus_EXPORTS -I/usr/include/eigen3 -O3 -DNDEBUG -fPIC -Wall -Werror -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unknown-pragmas -o CMakeFiles/Sophus.dir/sophus/so2.cpp.o -c /home/drew/svo/workspace/Sophus/sophus/so2.cpp
/home/drew/svo/workspace/Sophus/sophus/so2.cpp: In constructor ‘Sophus::SO2::SO2()’:
/home/drew/svo/workspace/Sophus/sophus/so2.cpp:32:26: error: lvalue required as left operand of assignmentunit_complex_.real() = 1.;^~
/home/drew/svo/workspace/Sophus/sophus/so2.cpp:33:26: error: lvalue required as left operand of assignmentunit_complex_.imag() = 0.;^~
CMakeFiles/Sophus.dir/build.make:65: recipe for target 'CMakeFiles/Sophus.dir/sophus/so2.cpp.o' failed
make[2]: *** [CMakeFiles/Sophus.dir/sophus/so2.cpp.o] Error 1
make[2]: Leaving directory '/home/drew/svo/workspace/Sophus/build'
CMakeFiles/Makefile2:107: recipe for target 'CMakeFiles/Sophus.dir/all' failed
make[1]: *** [CMakeFiles/Sophus.dir/all] Error 2
make[1]: Leaving directory '/home/drew/svo/workspace/Sophus/build'
Makefile:141: recipe for target 'all' failed
make: *** [all] Error 2
解决方法:修改Sophus下的so2.cpp文件
将下面这个修改一下:
unit_complex_.real() = 1.;
unit_complex_.imag() = 0.;
修改为:
unit_complex_.real(1.);
unit_complex_.imag(0.);