zoukankan      html  css  js  c++  java
  • 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中添加如下函数

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

    结果还是一直报错,然后添加各种预定宏也解决不了。

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

    namespace boost
    {
    #ifdef BOOST_NO_EXCEPTIONS
    
    void throw_exception( std::exception const & e ); // user defined
    
    #else
      //省略若干
    #endif
    } // namespace boost
    

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

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

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

  • 相关阅读:
    MFC CDialog/CDialogEx DoModal ALT
    yum和apt-get用法及区别
    ubuntu 12.04 source.list 源更新
    elasticsearch 优化
    TRIE树
    数据统计经验浅谈
    机器学习
    python 读取libsvm文件
    spark 参数调优
    python中的一些函数
  • 原文地址:https://www.cnblogs.com/woswod/p/8561825.html
Copyright © 2011-2022 走看看