开发者

wchar not working in VC++ 2005

wstring ws(L"Press 'q' to end.");
wcout << ws;

error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::wstring' (or there is no acceptable conversio开发者_开发百科n)

This is in a VC++ 2005 Win32 console app, created with default settings... which I think means UNICODE is on? I only just found out cout doesn't seem to support wstring, which seems a bit ugly - is that true? This app interacts with libraries which return wstrings and it might as well be Unicode, is there some project setting I need to change?


Try

wstring ws(L"Press 'q' to end."); 
wcout << ws.c_str(); 

BTW: wchar != wstring

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜