Boost logo

Boost Users :

Subject: [Boost-users] Compiling exception/get_error_info.hpp in Visual Stuido UNICODE project
From: Oleg V. Zhylin (ovz_at_[hidden])
Date: 2009-04-22 13:02:09


Hi,

  I'm trying to compile my project in MS Visual Studio 2008 with UNICODE and _UNICODE symbols defined. This automatically makes std::string resolve to std::wstring. I'm having a problem compiling exception/get_error_info.hpp because of the following code

        struct
        strwrap
            {
            std::string str;
            char const * ptr;

            explicit
            strwrap( char const * s ):
                str(s),
                ptr(&str[0])
                {
                }

Error messages quite predictably say about type inconsistency, there's a copy of them below my signature.

 Is there a known way to tweak boost to build seamlessly with Visual Studio Unicode projects?

WBR Oleg V. Zhylin ovz_at_[hidden]

g:\Program Files\boost\boost_1_38\boost\exception\get_error_info.hpp(30) : error C2664: 'std::basic_string<_Elem,_Traits,_Ax>::basic_string(const std::basic_string<_Elem,_Traits,_Ax>::_Alloc &)' : cannot convert parameter 1 from 'const char *' to 'const std::basic_string<_Elem,_Traits,_Ax>::_Alloc &'
        with
        [
            _Elem=wchar_t,
            _Traits=std::char_traits<wchar_t>,
            _Ax=std::allocator<wchar_t>
        ]
        and
        [
            _Elem=wchar_t,
            _Traits=std::char_traits<wchar_t>,
            _Ax=std::allocator<wchar_t>
        ]
        Reason: cannot convert from 'const char *' to 'const std::basic_string<_Elem,_Traits,_Ax>::_Alloc'
        with
        [
            _Elem=wchar_t,
            _Traits=std::char_traits<wchar_t>,
            _Ax=std::allocator<wchar_t>
        ]
        No constructor could take the source type, or constructor overload resolution was ambiguous
g:\Program Files\boost\boost_1_38\boost\exception\get_error_info.hpp(30) : error C2440: 'initializing' : cannot convert from 'std::allocator<_Ty>::value_type *' to 'const char *'
        with
        [
            _Ty=wchar_t
        ]
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
g:\Program Files\boost\boost_1_38\boost\exception\get_error_info.hpp(30) : error C2439: 'boost::exception_detail::strwrap::ptr' : member could not be initialized
        g:\Program Files\boost\boost_1_38\boost\exception\get_error_info.hpp(24) : see declaration of 'boost::exception_detail::strwrap::ptr'
g:\Program Files\boost\boost_1_38\boost\exception\diagnostic_information.hpp(60) : error C2664: 'std::basic_string<_Elem,_Traits,_Ax>::basic_string(const std::basic_string<_Elem,_Traits,_Ax>::_Myt &)' : cannot convert parameter 1 from 'std::basic_ostringstream<_Elem,_Traits,_Alloc>::_Mystr' to 'const std::basic_string<_Elem,_Traits,_Ax>::_Myt &'
        with
        [
            _Elem=wchar_t,
            _Traits=std::char_traits<wchar_t>,
            _Ax=std::allocator<wchar_t>
        ]
        and
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Alloc=std::allocator<char>
        ]
        and
        [
            _Elem=wchar_t,
            _Traits=std::char_traits<wchar_t>,
            _Ax=std::allocator<wchar_t>
        ]
        Reason: cannot convert from 'std::basic_ostringstream<_Elem,_Traits,_Alloc>::_Mystr' to 'const std::basic_string<_Elem,_Traits,_Ax>::_Myt'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Alloc=std::allocator<char>
        ]
        and
        [
            _Elem=wchar_t,
            _Traits=std::char_traits<wchar_t>,
            _Ax=std::allocator<wchar_t>
        ]
        No constructor could take the source type, or constructor overload resolution was ambiguous

      


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net