For Programmers: Free Programming Magazines  


Home > Archive > VC STL > February 2006 > Help with locale migration to VS2005









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Help with locale migration to VS2005
Notre Poubelle

2006-02-28, 7:07 pm

Hi,

I'm trying to migrate an app from VS 2003 to 2005. My code has a statement
like this:

locale loc (locale::classic(), new NoCodecvt);

where NoCodevt is defined like this:

class NoCodecvt : public codecvt<wchar_t, char, mbstate_t>
{
public:
virtual bool do_always_noconv () const {return (true);}
};

The first statement no longer compiles. The error messages are:

- error C2661: 'std::locale::facet::operator new' : no overloaded function
takes 3 arguments
- error C2664: 'std::locale::locale(const char *,std::locale::category)' :
cannot convert parameter 1 from 'const std::locale' to 'const char *'

Could anyone please advise how I could rewrite this for VS2005?

Thank you,
Notre
Igor Tandetnik

2006-02-28, 7:07 pm

Notre Poubelle <notre_poubelle@online.nospam> wrote:
> I'm trying to migrate an app from VS 2003 to 2005. My code has a
> statement like this:
>
> locale loc (locale::classic(), new NoCodecvt);
>
> where NoCodevt is defined like this:
>
> class NoCodecvt : public codecvt<wchar_t, char, mbstate_t>
> {
> public:
> virtual bool do_always_noconv () const {return (true);}
> };
>
> The first statement no longer compiles. The error messages are:
>
> - error C2661: 'std::locale::facet::operator new' : no overloaded
> function takes 3 arguments


Look for the following line in your code somewhere:

#define new DEBUG_NEW

MFC wizard puts it in. It messes with class-specific operator new(). It
looks like facet class now provides its own operator new.

> - error C2664: 'std::locale::locale(const char
> *,std::locale::category)' : cannot convert parameter 1 from 'const
> std::locale' to 'const char *'


This error will likely disappear once you fix the first one.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


Notre Poubelle

2006-02-28, 7:07 pm

That did it, thanks Igor!

P.S. I like your rfc quote. I had to look it up to see whether it really
existed :)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com