boost 라이브러리를 1.55 에서 1.59 로 업데이트 후 링크 시에 아래와 같은 오류가 발생했다.
error LNK2019: "void __cdecl boost::throw_exception(class std::exception const &)" (?throw_exception@boost@@YAXABVexception@std@@@Z) 외부 기호(참조 위치: "void __cdecl boost::exception_detail::throw_exception_<struct boost::escaped_list_error>(struct boost::escaped_list_error const &,char const *,char const *,int)" (??$throw_exception_@Uescaped_list_error@boost@@@exception_detail@boost@@YAXABUescaped_list_error@1@PBD1H@Z) 함수)에서 확인하지 못했습니다.
boost:tokenizer 를 사용하고 있는데 exception 이 1.55 에서는 throw 를 사용하고 있던 코드가 BOOST_THROW_EXCEPTION 를 사용하도록 바뀌어서 발생한 문제였다.
// 1.55
void do_escape(iterator& next,iterator end,Token& tok) {
if (++next == end)
throw escaped_list_error(std::string("cannot end with escape"));
if (Traits::eq(*next,'n')) {
...
// 1.59
void do_escape(iterator& next,iterator end,Token& tok) {
if (++next == end)
BOOST_THROW_EXCEPTION(escaped_list_error(std::string("cannot end with escape")));
if (Traits::eq(*next,'n')) {
...
BOOST_NO_EXCEPTIONS 설정을 사용하는 경우 throw_exception 을 각 플랫폼에 맞춰서 구현해줘야 했는데 지금까지는 exception 을 발생시키는 boost library 를 사용하고 있지 않아서 몰랐던 것이었다.
// throw_exception.hpp
void throw_exception( std::exception const & e ); // user defined
일단 아래와 같이 구현해서 링크 에러는 해결했다.
namespace boost
{
void throw_exception(std::exception const & e)
{
throw e;
}
}