slambook icon indicating copy to clipboard operation
slambook copied to clipboard

ch4 编译 useSophus 报错

Open WithFoxSquirrel opened this issue 6 years ago • 4 comments

编译useSophus 报错

  /usr/local/include/sophus/common.hpp:44:10: error: 'auto' not allowed in function return type
    static auto test(int)
           ^~~~
  /usr/local/include/sophus/common.hpp:44:24: error: expected ';' at end of declaration list
    static auto test(int)

查资料有说是c++11的问题,cmakelists增加 set( CMAKE_CXX_FLAGS "-std=c++14 -O3" ) 后,编译报

   /Users/hans.hu/work/slam/slambook/ch4/useSophus/useSophus.cpp:16:13: error: use of class template 'Sophus::SO3' requires template arguments
       Sophus::SO3 SO3_R(R);               // Sophus::SO(3)可以直接从旋转矩阵构造
               ^
   /usr/local/include/sophus/so3.hpp:423:7: note: template is declared here
   class SO3 : public SO3Base<SO3<Scalar_, Options>> {

WithFoxSquirrel avatar Oct 18 '18 03:10 WithFoxSquirrel

书里代码用的是早期非模板版本的sophus。在git clone sophus之后需要checkout到指定版本才能编译。

gaoxiang12 avatar Oct 19 '18 02:10 gaoxiang12

snip20181019_12

按照书上,checkout到 git checkout a621ff (实际是a621ff2)

snip20181019_13

编译出错,修改unit_complex_ real() = 1.0 ; => unit_complex_.real(1.0); 编译成功

然后到ch4/useSophus/build 目录, make

snip20181022_14

clang 版本和平台 Apple LLVM version 9.1.0 (clang-902.0.39.2) , update_se3(0,0) = 1e-4d; -> update_se3(0,0) = 1e-4;

image

高博,书上的有些例子不能在 osx 上编译吗?

WithFoxSquirrel avatar Oct 22 '18 01:10 WithFoxSquirrel

不知高博能否告知,你所使用的gcc版本?

roachsinai avatar Nov 29 '18 10:11 roachsinai

snip20181019_12

按照书上,checkout到 git checkout a621ff (实际是a621ff2)

snip20181019_13

编译出错,修改unit_complex_ real() = 1.0 ; => unit_complex_.real(1.0); 编译成功

然后到ch4/useSophus/build 目录, make

snip20181022_14

clang 版本和平台 Apple LLVM version 9.1.0 (clang-902.0.39.2) , update_se3(0,0) = 1e-4d; -> update_se3(0,0) = 1e-4;

image

高博,书上的有些例子不能在 osx 上编译吗?

分别改为: unit_complex_.real(1.); unit_complex_.imag(0.); 以及 update_se3(0,0) = 1e-4; 就可以编译通过

LvjianLu avatar Jul 20 '22 08:07 LvjianLu

您好,我叫旷鸿章,我已经收到了你的邮件。谢谢!

BTREE-C802 avatar Jul 20 '23 08:07 BTREE-C802