2009-05-23 4 views
0

부스트 1.38을 사용하고 있었고 방금 1.39로 업그레이드했습니다. 업그레이드를 통해 다음 코드가 깨졌습니다.부스트 1.38에서 1.39로 업그레이드하면 boost :: algorithm :: split이 컴파일되지 않습니다.

std::vector<std::wstring> consoleParser::loadStringsFromFile(const std::wstring &fileName) 
{ 
    std::vector<std::wstring> files; 
    std::wstring fileString(loadFileAsString(fileName)); 
    boost::algorithm::split(files, fileString, boost::is_any_of(L"\r\n'\"")); //Error on this line 
    return files; 
} 

오류의 원인에 대한 아이디어가 있으십니까? 내 컴파일러는 다음을 유용하게 출력합니다.

c:\boost\boost\utility\addressof.hpp(30) : error C2220: warning treated as error - no 'object' file generated 
     c:\boost\boost\utility\addressof.hpp(56) : see reference to class template instantiation 'boost::detail::addr_impl_ref<T>' being compiled 
     with 
     [ 
      T=boost::algorithm::detail::token_finderF<boost::algorithm::detail::is_any_ofF<wchar_t>> 
     ] 
     c:\boost\boost\function\function_template.hpp(600) : see reference to function template instantiation 'T *boost::addressof<FunctionObj>(T &)' being compiled 
     with 
     [ 
      T=boost::algorithm::detail::token_finderF<boost::algorithm::detail::is_any_ofF<wchar_t>>, 
      FunctionObj=boost::algorithm::detail::token_finderF<boost::algorithm::detail::is_any_ofF<wchar_t>> 
     ] 
     c:\boost\boost\function\function_template.hpp(491) : see reference to function template instantiation 'bool boost::detail::function::basic_vtable2<R,T0,T1>::assign_to<F>(FunctionObj,boost::detail::function::function_buffer &,boost::detail::function::function_obj_tag)' being compiled 
     with 
     [ 
      R=boost::iterator_range<std::_String_iterator<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>>, 
      T0=std::_String_iterator<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>, 
      T1=std::_String_iterator<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>, 
      F=boost::algorithm::detail::token_finderF<boost::algorithm::detail::is_any_ofF<wchar_t>>, 
      FunctionObj=boost::algorithm::detail::token_finderF<boost::algorithm::detail::is_any_ofF<wchar_t>> 
     ] 
     c:\boost\boost\function\function_template.hpp(906) : see reference to function template instantiation 'bool boost::detail::function::basic_vtable2<R,T0,T1>::assign_to<Functor>(F,boost::detail::function::function_buffer &)' being compiled 
     with 
     [ 
      R=boost::iterator_range<std::_String_iterator<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>>, 
      T0=std::_String_iterator<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>, 
      T1=std::_String_iterator<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>, 
      Functor=boost::algorithm::detail::token_finderF<boost::algorithm::detail::is_any_ofF<wchar_t>>, 
      F=boost::algorithm::detail::token_finderF<boost::algorithm::detail::is_any_ofF<wchar_t>> 
     ] 
     c:\boost\boost\function\function_template.hpp(720) : see reference to function template instantiation 'void boost::function2<R,T0,T1>::assign_to<Functor>(Functor)' being compiled 
     with 
     [ 
      R=boost::iterator_range<std::_String_iterator<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>>, 
      T0=std::_String_iterator<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>, 
      T1=std::_String_iterator<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>, 
      Functor=boost::algorithm::detail::token_finderF<boost::algorithm::detail::is_any_ofF<wchar_t>> 
     ] 
     c:\boost\boost\algorithm\string\detail\find_iterator.hpp(51) : see reference to function template instantiation 'boost::function2<R,T0,T1>::function2<FinderT>(Functor,int)' being compiled 
     with 
     [ 
      R=boost::iterator_range<std::_String_iterator<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>>, 
      T0=std::_String_iterator<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>, 
      T1=std::_String_iterator<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>, 
      FinderT=boost::algorithm::detail::token_finderF<boost::algorithm::detail::is_any_ofF<wchar_t>>, 
      Functor=boost::algorithm::detail::token_finderF<boost::algorithm::detail::is_any_ofF<wchar_t>> 
     ] 
     c:\boost\boost\algorithm\string\find_iterator.hpp(261) : see reference to function template instantiation 'boost::algorithm::detail::find_iterator_base<IteratorT>::find_iterator_base<FinderT>(FinderT,int)' being compiled 
     with 
     [ 
      IteratorT=input_iterator_type, 
      FinderT=boost::algorithm::detail::token_finderF<boost::algorithm::detail::is_any_ofF<wchar_t>> 
     ] 
     c:\boost\boost\algorithm\string\iter_find.hpp(167) : see reference to function template instantiation 'boost::algorithm::split_iterator<IteratorT>::split_iterator<FinderT>(IteratorT,IteratorT,FinderT)' being compiled 
     with 
     [ 
      IteratorT=input_iterator_type, 
      FinderT=boost::algorithm::detail::token_finderF<boost::algorithm::detail::is_any_ofF<wchar_t>> 
     ] 
     c:\boost\boost\algorithm\string\split.hpp(149) : see reference to function template instantiation 'SequenceSequenceT &boost::algorithm::iter_split<SequenceSequenceT,RangeT,boost::algorithm::detail::token_finderF<PredicateT>>(SequenceSequenceT &,RangeT &,FinderT)' being compiled 
     with 
     [ 
      SequenceSequenceT=std::vector<std::wstring>, 
      RangeT=std::wstring, 
      PredicateT=boost::algorithm::detail::is_any_ofF<wchar_t>, 
      FinderT=boost::algorithm::detail::token_finderF<boost::algorithm::detail::is_any_ofF<wchar_t>> 
     ] 
     c:\documents and settings\user\my documents\visual studio 2008\projects\pevfind\pevfind\consoleparser.cpp(1529) : see reference to function template instantiation 'SequenceSequenceT &boost::algorithm::split<std::vector<_Ty>,std::wstring,boost::algorithm::detail::is_any_ofF<CharT>>(SequenceSequenceT &,RangeT &,PredicateT,boost::algorithm::token_compress_mode_type)' being compiled 
     with 
     [ 
      SequenceSequenceT=std::vector<std::wstring>, 
      _Ty=std::wstring, 
      CharT=wchar_t, 
      RangeT=std::wstring, 
      PredicateT=boost::algorithm::detail::is_any_ofF<wchar_t> 
     ] 
c:\boost\boost\utility\addressof.hpp(30) : warning C4512: 'boost::detail::addr_impl_ref<T>' : assignment operator could not be generated 
     with 
     [ 
      T=boost::algorithm::detail::token_finderF<boost::algorithm::detail::is_any_ofF<wchar_t>> 
     ] 

답변

3

새 경고가 방출되어 (boost::detail::addr_impl_ref<T>' : assignment operator could not be generated) 컴파일이 실패했으며 경고가 오류로 처리되도록 설정되었습니다. thisthis으로 판단하면 실제로 Boost 1.39.0 및 VS2008에서 문제가됩니다.

후자의 링크는 문제를 해결하는 패치를 제공합니다. Boost 1.40.0에서 수정되어야합니다.

대신 "경고를 오류로 처리"플래그를 일시적으로 비활성화 할 수 있습니다.

1

경고 수준 4로 전환하고 경고를 오류로 처리하면 내 고장이 발생합니다. 해당 설정을 변경해보십시오.

0

내가 정말 좋아하는 이유는 이런 종류의 "경고를 오류로 처리",하지만 당신은 다만 수 없습니다 : addressof.hpp에 대한 사용법 #include 라인 위의

#pragma warning (disable:4512) 

합니다.

관련 문제