slam十四讲-ch4中碰到的问题

关于在学习slam十四讲在ch4章节实践SoPhus的过程中碰到两个问题:
问题1:编译Sophus的过程中,提示如下错误:

/Sophus/sophus/so2.cpp:32:26: error: lvalue required as left operand of assignment
unit_complex_.real() = 1.;

/Sophus/sophus/so2.cpp:33:26: error: lvalue required as left operand of assignment
unit_complex_.imag() = 0.;
解决方法:

将指示部分修改为:

SO2::SO2()
{
//unit_complex_.real() = 1.;
//unit_complex_.imag() = 0.;
unit_complex_.real(1.);
unit_complex_.imag(0.);
}

该部分参考原github的issue部分可以解决点击此处进入

**问题2
首先,原slam十四讲自带的Sophus是在3rdparty这个文件夹下的,如果你上述编译Sophus库是在该文件夹下,是不会出现下面这个问题。但是我由于想看一下Sophus库是不是更新了新的代码,参考书中第80页如下代码:

git clone https://github.com/strasdat/Sophus.git
cd Sophus
git checkout a621ff

将Sophus库编译在其他路径下了,然后在make程序useEigen部分时报错:

~/文档/slambook-master/ch4/useSophus/build$ make
Scanning dependencies of target useSophus
[ 50%] Building CXX object CMakeFiles/useSophus.dir/useSophus.cpp.o
make[2]: *** 没有规则可制作目标“/home/panpanhuang/文档/slambook-master/3rdparty/Sophus/build/libSophus.so”,由“useSophus” 需求。 停止。
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/useSophus.dir/all' failed
make[1]: *** [CMakeFiles/useSophus.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

这一部分我没有去找,根据路径我是初步判断Sophus库编译错了地方,起初个人浅见,库编译在哪里没有问题,事实不是这样。我重新在3edparty下修改了问题1中描述的代码,重新编译了Sophus库,之后在编译运行代码,就没错。
补充:目前在出现问题,先记下来。没有找不在3rdparty下编译库程序不能make的具体原因,只能先解决问题,后续再去看。

你可能感兴趣的:(slam,十四讲学习)