系统环境
ubuntu20的系统,跑代码需要sophus非模板类的依赖。
安装过程
- 从github上安装
git clone https://github.com/strasdat/Sophus.git
cd Sophus
git checkout a621ff
mkdir build
cd build
cmake ../ -DUSE_BASIC_LOGGING=ON
make
sudo make install
但是在make的时候会报错:
/home/xz/下载/dependence/Sophus/sophus/so2.cpp:32:26: error: lvalue required as left operand of assignment
32 | unit_complex_.real() = 1.;
| ^~
/home/xz/下载/dependence/Sophus/sophus/so2.cpp:33:26: error: lvalue required as left operand of assignment
33 | unit_complex_.imag() = 0.;
| ^~
找到/Sophus/sophus目录下so2.cpp文件。
找到如下代码:
SO2::SO2()
{
unit_complex_.real() = 1.;
unit_complex_.imag() = 0.;
}
改成:
SO2::SO2()
{
unit_complex_.real(1.);
unit_complex_.imag(0.);
}
最后即可安装成功