Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2002-02-15 13:10:32


on 2/14/02 4:32 AM, Gennadiy at rogeeff_at_[hidden] wrote:

> I was not able to compile the library using MSVC6SP5.
>
> Without STLPort:
>
> ....\iostate\libs\io\test\iostate_test.cpp(154) : error
> C2664: '__thiscall std::locale::std::locale(const char *,int)' :
> cannot convert parameter 1 from 'class std::locale' to 'const char *'
> No user-defined-conversion operator available that can
> perform this conversion, or the operator cannot be called
> ...\iostate\libs\io\test\iostate_test.cpp(227) : error
> C2664: '__thiscall std::locale::std::locale(const char *,int)' :
> cannot convert parameter 1 from 'class std::locale' to 'const char *'
> No user-defined-conversion operator available that can
> perform this conversion, or the operator cannot be called
>
> With STLPort 4.5
>
> iostate_test.obj : error LNK2001: unresolved external
> symbol "__declspec(dllimport) public: __thiscall _STL::locale::locale
> (class locale::locale const &,class backward_bool_names *)" (__imp_??
> 0locale@_STL@@QAE_at_ABV01@PAVbackward_bool_names@@@Z)
>
> Do you have a patch for it?

Someone else came to me with a similar problem. I don't think MSVC has
facet support in its locales. Does your std::locale have the following
templated constructor:

//=========================================================================
namespace std
{
class locale
{
    //...

    template <class Facet>
    locale(const locale& other, Facet* f);

    //...
};
}
//=========================================================================

That's the constructor that those two lines use.

The other person gave me a quick & dirty workaround:

//=========================================================================
Replace the line
    locale loc( locale(""), new backward_bool_names("") );
with
    locale loc(locale("")._Addfac(new backward_bool_names(""),
                                    100, //TODO get your local locale
expert to fix this
                                    _LC_CTYPE
                                    )
                );

You would need someone with more knowledge, time and interest to supply the
correct magic incantation before using loc outside of a test program.
//=========================================================================

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com

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