• Pangolin安装报错解决


    Pangolin安装报错解决

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

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

    首先需要安装OpenGL

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

    mkdir build
    cd build
    cmake ..
    make
    
    • 1
    • 2
    • 3
    • 4

    不出意外的话,会报错:

    • 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(this)->u_.number_ = u_.int64_), u_.number_))
      

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

    • include/pangolin/gl/gl.h, include/pangolin/gl/colour.h 这两个文件,加入
    #include 
    #include 
    
    • 1
    • 2
    • 在对应的CMakeLists.txt中加入C++11
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ")
    
    • 1
    • 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_)
    
    • 1
    • 2
    • 3
    • 4
    • 5

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

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

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

  • 相关阅读:
    Springboot项目中@JsonProperty不生效-如何处理呢?
    Socket通信原理
    Springboot+学生作业管理系统 毕业设计-附源码251208
    JVM之方法的调用
    产品新人必看:入职前的准备及快速适应产品工作
    低代码开发浅析
    自定义MVC原理
    一个纯Python编写的轻量级数据库 -- TinyDB
    1.6-14:求10000以内n的阶乘
    分布式锁Redisson
  • 原文地址:https://blog.csdn.net/NICAI001/article/details/128064465