unresolved external symbol boost::throw_exception

使用boost库,VS生成的时候一直报错,
error LNK2019: 没法解析的外部符号 "void __cdecl boost::throw_exception(class std::exception const &)"函数

搜索网上资料得知,多是使用的boost库默认定义了BOOST_NO_EXCEPTIONS宏,须要用户自定义throw_exception函数,在报错的那个cpp中添加以下函数spa

void throw_exception(std::exception const & e) // user defined
{
    return;
}

结果仍是一直报错,而后添加各类预约宏也解决不了。.net

后来查看<boost\throw_exception.hpp>发现,应该使用namespace boostcode

namespace boost
{
#ifdef BOOST_NO_EXCEPTIONS

void throw_exception( std::exception const & e ); // user defined

#else
  //省略若干
#endif
} // namespace boost

在报错的那个cpp中添加以下函数后解决blog

namespace boost
{
    void throw_exception(std::exception const & e) // user defined
    {
        return;
    }
}

最后,感谢http://blog.csdn.net/is2120/article/details/6385304io

相关文章
相关标签/搜索