天天看点

SLAM十四讲中Sophus库的make报错 lvalue required as left operand of assignment unit_complex_.real()

最近开始学习高翔博士的《视觉SLAM十四讲》,第四章要求安装一个非模板类的Sophus库。在安装书中提供的第三方库时出现错误。在安装过程中,使用Cmake ..的时候能够顺利通过,接着执行make命令的时候就会出现错误如下:

***1. Sophus/sophus/so2.cpp:33:26:error: lvalue required as left operand of assignment

unit_complex_.real() = 1.;

2. Sophus/sophus/so2.cpp:33:26:error: lvalue required as left operand of assignment

unit_complex_.imag() = 1.;*

我以为是书中提供的第三方库存在问题,于是按照书中的方法在网上重新下载Sophus库,编译之后仍旧出现这种错误。

自己在网上查找了好久很少有人提出解决这个问题的方法。最终幸运的在一篇博客中找到了解决的方法。鉴于网上的解决方法少,故分享如下。

解决方法如下:

1  SO2::SO2()

2 {

3   //unit_complex_.real() = 1.;

4   //unit_complex_.imag() = 0.;

5   unit_complex_.real(1.);

6   unit_complex_.imag(0.);

7 }

---------------------

作者:江上雨

来源:CSDN

原文:https://blog.csdn.net/qq_40641575/article/details/81006349

版权声明:本文为博主原创文章,转载请附上博文链接!

继续阅读