美文网首页
Boost-1.54.0 在ubuntu下编译出现./boost

Boost-1.54.0 在ubuntu下编译出现./boost

作者: 5john家安 | 来源:发表于2018-11-22 18:16 被阅读0次

    在ubuntu环境下编译安装Boost-1.54.0后,调用时出现如下错误:

    gcc.compile.c++ bin.v2/libs/atomic/build/gcc-4.8/release/link-static/threading-multi/lockpool.o
    In file included from ./boost/atomic.hpp:12:0,
                     from libs/atomic/src/lockpool.cpp:1:
    ./boost/atomic/atomic.hpp:166:16: error: ‘uintptr_t’ was not declared in this scope
     typedef atomic<uintptr_t> atomic_uintptr_t;
                    ^
    ./boost/atomic/atomic.hpp:166:25: error: template argument 1 is invalid
     typedef atomic<uintptr_t> atomic_uintptr_t;
                             ^
    ./boost/atomic/atomic.hpp:166:43: error: invalid type in declaration before ‘;’ token
     typedef atomic<uintptr_t> atomic_uintptr_t;
    

    解决办法:

    1. 进入安装的boost的头文件目录打开cstdint.hpp文件,博主的文件是/usr/local/include/boost/cstdint.hpp
    2. 找到#if defined(BOOST_HAS_STDINT_H) && (!defined(__GLIBC__) || defined(__GLIBC_HAVE_LONG_LONG))这句把它注释掉换成下面的代码
    #if defined(BOOST_HAS_STDINT_H) \
    && (!defined(__GLIBC__) \
    || defined(__GLIBC_HAVE_LONG_LONG) \
    || (defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 17)))))
    

    结果:再次调用boost库时不再出现这个问题,解决

    相关文章

      网友评论

          本文标题:Boost-1.54.0 在ubuntu下编译出现./boost

          本文链接:https://www.haomeiwen.com/subject/yqcrqqtx.html