Eigen库和Sophus库遇到的问题

编译代码时,报错

error: ‘ReturnScalar’ was not declared in this scope using HomogeneousPointProduct = Vector3<ReturnScalar<HPointDerived>>;

error: template argument 1 is invalid using SO2Product = SO2<ReturnScalar<OtherDerived>>;

等很多错误,原因是:Eigen和Sophus版本不匹配。

经检查,是我不知道什么时候安装了3.2.10版本的eigen,版本太低了。

一般情况下,ros系统自动安装了3.3.7版本的eigen,完全够用。所以这个版本冲突问题一般也不会遇到。

版本正确后,编译出现报错:

error: ‘std::optional’ has not been declared std::optional<Scalar> const& theta_o = std::nullopt) {

error: expected ‘,’ or ‘...’ before ‘<’ token std::optional<Scalar> const& theta_o = std::nullopt) {

等多个错误,原因是编译环境(比如编译器版本或编译选项)不支持 C++17 标准或者没有启用 C++17 标准。

解决方法:改成C++17就行

add_compile_options(-std=c++17)

之前在使用其他库的时候也遇到过C++标准不对应问题,现在简单总结,感觉只要是std:: 的error就可能是C++标准问题

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值