Why is it when i do the following i get errors when relating to with wchar_t?
namespace Foo
{
typedef std::wstring String;
}
Now i declare all my strings as Foo::String through out the program, but when i ever attempt to create a new Foo::String from a wchar_t* i get an error, e.g.:
namespace Bar
{
static const wchar_t* COMMON_BAR = L"Hello";
}
int main()
{
Foo::String A(Bar::COMMON_BAR);
};
I get the following error from visual studio:
error C2440: <function-style-cast> : cannot convert from const wchar_t * to Foo::String
Whats wrong?
EDIT Sorry i ment to say Bar::COMMON_BAR :(
Also i am compiling on visual studio 2008. I am really frustrated by this.
EDIT#2
Sorry i couldn t respond to this sooner. The problems turns out to be a bigger issue than i wanted. I now noticed how much using std::wstring; s there are floating around in the code.
This is at the absolute bottom of the global headerfile.
// WStrings are a waste
// Feb 2007
#define wstring string
Ugh. Thanks, sorry this is kinda a waste of space :(