`
smartvessel
  • 浏览: 80853 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

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

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics