「功能」 : 无法从“double”转换到“wchar_t *”
我正在尝试在 Visual Studio 2010 中进行编译,这正是我得到的错误:
Error 65 error C2440: 'function' :
cannot convert from 'double' to 'const wchar_t *'
违规行是:
swprintf(subbuf[num], L"%f\0", va_arg(args, double));
This is Should to compile cleanly so codechanges not suggest. 我是否缺少任何可以解决此问题的编译器选项?
编辑:
这是subbuf
的声明:
#define GDB_CHAR wchar_t
GDB_CHAR subbuf[MAX_SUBS][STATUS_MSG_LEN+1] ;
另外,关于大小参数,我还检查了文档页面,但是,编译器 不会抛出错误,
swprintf(subbuf[num], L"%c\0", va_arg(args, int));
因此从 int
转换为 wchar_t *
时没有问题,并且函数的参数也正常。
如果这仍然不够丰富,请发表评论并指导我找到你们需要的任何其他信息。 谢谢
I am trying to compile in visual studio 2010, and this is the exact error I get:
Error 65 error C2440: 'function' :
cannot convert from 'double' to 'const wchar_t *'
The offending line being:
swprintf(subbuf[num], L"%f\0", va_arg(args, double));
This is supposed to compile cleanly so code changes are not recommended.
Am I missing any compiler option which might resolve this?
EDIT:
Here is the declaration of subbuf
:
#define GDB_CHAR wchar_t
GDB_CHAR subbuf[MAX_SUBS][STATUS_MSG_LEN+1] ;
Also, regarding the size argument, I also checked the documentation page, however, compiler
doesn't throw an error on
swprintf(subbuf[num], L"%c\0", va_arg(args, int));
So it has no issues in converting from int
to wchar_t *
and the function's arguments are ok.
If this is still not informative enough, please comment and direct me to any other you guys need.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
快速浏览一下文档表明该函数需要一个参数来指定输出字符串的大小,您已省略。
A quick glance at the documentation shows that the function requires an argument specifying the size of the output string, which you have omitted.