LNK2019 when including asio headers, solution generated with cmake

前端 未结 4 469
失恋的感觉
失恋的感觉 2021-02-04 12:26

I am trying to port a big project from gcc (Linux) to msvc (windows), using cmake and boost libraries.

The project compile and runs fine for gcc but on msvc it returns t

4条回答
  •  难免孤独
    2021-02-04 13:05

    In my case, the /EHsc flag did not work. Turned out that BOOST_NO_EXCEPTIONS was defined so the compiler was searching for the "user defined" (as in boost/throw_exception.hpp) function.

    Therefore, a quick fix is to write your favorite boost::throw_exception() function:

    namespace boost
    {
    #ifdef BOOST_NO_EXCEPTIONS
    void throw_exception( std::exception const & e ){
        throw 11; // or whatever
    };
    #endif
    }// namespace boost
    

提交回复
热议问题