Boost logo

Boost :

Subject: Re: [boost] [filesystem] Linker error against std::codecvt in VS2012 RC
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2012-06-01 18:35:55


On Jun 1, 2012, at 3:09 PM, Stephan T. Lavavej wrote:

> [Lars Viklund]
>> I foolishly installed the Visual Studio 2012 RC yesterday night and made
>> an overnight build of Boost.
>
>> [1] 1>libboost_filesystem-vc110-mt-gd-1_50.lib(path.obj) : error
>> LNK2001: unresolved external symbol "protected: virtual int __thiscall
>> std::codecvt<wchar_t,char,int>::do_length(int const &,char const *,char
>> const *,unsigned int)const "
>> (?do_length@?$codecvt@_WDH_at_std@@MBEHABHPBD1I_at_Z)
>
> FYI, Marshall Clow reported DevDiv#307389 "codecvt: length() and do_length() should take modifiable stateT&", which we've fixed in VC11/VS2012. Previously (in VC10 and earlier) we took const stateT&, which didn't follow the Standard.
>
> The difference is highly significant to anyone attempting to override this virtual function. Unfortunately, I have no way of informing users automatically when they're affected by this change, so my plan is to fall back on my usual response of "because the Standard told us to" - or in this case, "because Marshall told us to". :->
>
>> I dread to think of the horror that I will have go through in actually
>> reporting a bug against the runtime itself :(
>
> The usual path is Microsoft Connect, but you may report STL bugs directly to me at stl_at_[hidden] . (I strongly appreciate self-contained repros, unless the problem in the source code is ridiculously obvious).
>
> As a service to Boost, I will also file compiler and CRT bugs (in which case a self-contained repro is mandatory, because I'm just going to copy-and-paste it into TFS and let those teams figure it out).

[ Warning: Untested fix follows ]
If you look at boost/detail/utf8_codecvt_facet.hpp, you'll see:

        #if !defined(__MSL_CPP__) && !defined(__LIBCOMO__)
            #define BOOST_CODECVT_DO_LENGTH_CONST const
        #else
            #define BOOST_CODECVT_DO_LENGTH_CONST
        #endif

If you change (in your copy) to replace all five of those lines with:
            #define BOOST_CODECVT_DO_LENGTH_CONST

then it should work with VS2012 (but not with VS2011).

Please file a bug so that will remember to fix it (permanently) for the next boost release.

-- Marshall

Marshall Clow Idio Software <mailto:mclow.lists_at_[hidden]>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
        -- Yu Suzuki


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk