zoukankan      html  css  js  c++  java
  • Boost asio Tutorial例子Timer.5 make error

     

    Boost asio Tutorial

    例子Timer.5 - Synchronising handlers in multithreaded programs编译错误

    作者:smartvessel@gmail.com

    环境:cygwin+boost1.41.0

     

    报错信息:

    make all

    Building file: ../src/boosthello.cpp

    Invoking: Cygwin C++ Compiler

    g++ -D__USE_W32_SOCKETS -D_WIN32_WINNT -I"D:\cygwin\usr\local\include\boost" -O0 -g3 -c -fmessage-length=0 -MMD -MP -MF"src/boosthello.d" -MT"src/boosthello.d" -o"src/boosthello.o" "../src/boosthello.cpp"

    In file included from /usr/local/include/boost/thread/future.hpp:12,

                     from /usr/local/include/boost/thread.hpp:24,

                     from ../src/boosthello.cpp:9:

    /usr/local/include/boost/exception_ptr.hpp:43: error: looser throw specifier for `virtual boost::exception_ptr::~exception_ptr()'

    /usr/local/include/boost/exception/detail/exception_ptr_base.hpp:28: error:   overriding `virtual boost::exception_detail::exception_ptr_base::~exception_ptr_base() throw ()'

    make: *** [src/boosthello.o] Error 1

    这是个make的报错,涉及exception_ptr.hppexception_ptr_base.hpp两个文件,于两个析构函数有关,而且析构函数是虚函数。

    一番调查发现exception_ptr_base.hppclass exception_ptr_base定义了虚拟析构函数,而exception_ptr.hppclass exception_ptr继承之exception_ptr_base,但是没有实现其虚拟析构函数。

    因此在exception_ptr中添加

            ~exception_ptr()throw()

            {

            }

    这样就可以解决错误,这应该是1.41.0的一个bug

  • 相关阅读:
    restframework 自定义返回响应格式
    restframework 分页器
    Python设计模式
    Pytest系列
    Pytest系列
    Pytest系列 -pytest-dependency 用例依赖
    restframework jwt登录验证
    restframework 自定义json返回格式
    Axure RP8 注册码
    LVM 移除PV步骤
  • 原文地址:https://www.cnblogs.com/smartvessel/p/1612829.html
Copyright © 2011-2022 走看看