开发者

wchar not working in VC++ 2005

开发者 https://www.devze.com 2023-01-07 05:31 出处:网络
wstring ws(L\"Press \'q\' to end.\"); wcout << ws; error C2679: binary \'<<\' : no operator
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

精彩评论

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

关注公众号