wchar 无法在 VC 中工作++ 2005年

发布于 2024-09-10 14:53:00 字数 359 浏览 1 评论 0原文

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

错误 C2679:二进制“<<” :无操作员 发现它需要一个右手操作数 类型为“std::wstring”(或者没有 可接受的转换)

这是在 VC++ 2005 Win32 控制台应用程序中,使用默认设置创建的...我认为这意味着 UNICODE 已打开?我刚刚发现 cout 似乎不支持 wstring,这看起来有点难看 - 这是真的吗?这个应用程序与返回 wstrings 的库交互,它也可能是 Unicode,是否有一些我需要更改的项目设置?

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 conversion)

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

喵星人汪星人 2024-09-17 14:53:00

顺便尝试

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

一下:wchar != wstring

Try

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

BTW: wchar != wstring

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文