boostorg / exception

Boost.org exception module
http://boost.org/libs/exception
Boost Software License 1.0
15 stars 46 forks source link

unresolved external symbol "void __cdecl boost::throw_exception with VS2019 #52

Closed sthalasayanam closed 1 year ago

sthalasayanam commented 1 year ago

I get the compiler error unresolved external symbol "void __cdecl boost::throw_exception in VS2019 even if I have the custom function

namespace boost{

ifdef BOOST_NO_EXCEPTIONS

template<class E>
void throw_exception(E const& e) {
//do nothing

}

endif

}

zajo commented 1 year ago

There are two issues with your function:

First, it may not be a template. It should just take a std::exception const &.

Secondly, it is not allowed to return, so can't "do nothing". Call terminate or throw an exception, those are your choices.