Pangolin安装报错解决

Pangolin安装报错解决

视觉SLAM十四讲$3.7节需要。

在本地slambook2/3rdparty文件夹git submodule update,这个版本是和书中的版本一致的。

首先需要安装OpenGL

以及Cmake、C++11等,
然后建立build文件夹,在内部编译:

mkdir build
cd build
cmake ..
make

不出意外的话,会报错:

  • include/pangolin/gl/colour.h:57:18: error: ‘numeric_limits’ is not a member of ‘std’
    57 | std::numeric_limits::quiet_NaN(), std::numeric_limits::quiet_NaN(),
  • include/pangolin/utils/picojson.h:383:12: note: in definition of macro ‘GET’
    383 |     return var;
  • include/pangolin/utils/picojson.h:390:124: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
    390 | ->type_ = number_type, const_cast<value*>(this)->u_.number_ = u_.int64_), u_.number_))
    

我改动了几个文件,然后通过编译了。具体改动是:

  • include/pangolin/gl/gl.h, include/pangolin/gl/colour.h 这两个文件,加入
#include <stdexcept>
#include <limits>
  • 在对应的CMakeLists.txt中加入C++11
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ")
  • include/pangolin/utils/picojson.h 文件390行加2个括号
#ifdef PICOJSON_USE_INT64
GET(double,
    (type_ == int64_type && ((const_cast<value *>(this)->type_ = number_type), (const_cast<value *>(this)->u_.number_ = u_.int64_)),
     u_.number_))
GET(int64_t, u_.int64_)

如果实在不行,总是报错,比如你已经重新安装了Eigen库,这时有可能因为版本不一致而无法安装书中指定的这个版本的Pangolin。那么只需要在别的文件夹获取一个pangolin并编译就行了,可参考readme进行安装。

git clone https://github.com/stevenlovegrove/Pangolin.git

有博客指出直接git clone这个有各种问题导致编译不过,应该用GitHub上的release版压缩包,别git clone。

猜你喜欢

转载自blog.csdn.net/NICAI001/article/details/128064465
今日推荐