在MSVC 11中升压“析构函数不是虚拟的”错误

我想使用MSVC 11.0编译一个升压1.57.0的程序,我得到以下错误:

z:\d\dev\boost_1_57_0\boost\exception\exception.hpp(171) : error C4265: 'boost::exception_detail::error_info_container' but destructor is not virtual instances of this class may not be destructed correctly 

有什么我可以做的吗?

这些post似乎没有提供解决scheme

  • http://boost.2283326.n4.nabble.com/boost-exception-detail-error-info-base-does-not-have-virtual-destructor-td3384903.html
  • http://boost.2283326.n4.nabble.com/Re-exception-warning-about-non-virtual-destructor-resolution-td4554753.html

我以前应该想过这个。 错误是通过/W4提示错误的警告。 我设法通过在include包装上禁用警告来解决这个问题。

 #pragma warning(push) #pragma warning(disable : 4265) #include <boost/...> #pragma warning(pop)