如何解决 Visual Studio 2005 中的错误 C2664 _vswprintf_c_l 错误?
显示的错误:
Error 11 error C2664: '_vswprintf_c_l' : cannot convert parameter 4 from 'void *' to '_locale_t' C:\Program Files\Microsoft Visual Studio 8\VC\include\swprintf.inl 41
它找到文件 - C:\Program Files\Microsoft Visual Studio 8\VC\include\swprintf.inl
我猜这是一个系统文件。那么,如何解决呢?
平台:Visual Studio 2005 版本8.0.50727.762
The error shown:
Error 11 error C2664: '_vswprintf_c_l' : cannot convert parameter 4 from 'void *' to '_locale_t' C:\Program Files\Microsoft Visual Studio 8\VC\include\swprintf.inl 41
It locates the file- C:\Program Files\Microsoft Visual Studio 8\VC\include\swprintf.inl
which is a system file I guess. So, how to resolve?
Platform: Visual Studio 2005
Version 8.0.50727.762
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也在我正在处理的代码中看到了这个问题。
问题是 stdlib.h 包含在本地标头之后,该标头可能包含其他一些 c 或 c++ 标头。
错误的顺序:
只需颠倒包含顺序即可解决我的问题:
如果您使用 string.h ,似乎也会出现相同的问题
I've also seen this issue in a code I was dealing with.
The problem was that stdlib.h was being included after a local header which probably was including some other c or c++ header.
wrong order:
just reversing the include order fixed my problem:
seems like the same problem can occur if you are using string.h
就我而言,它在 C++ 代码中使用旧版 C 标头,其中在某些旧版 C 标头中包含 #define NULL ((void *)0) 。我的错误消息是“C2664 ...无法将参数 3 从 void * 转换为 const_locale_t”。有问题的参数是 NULL。通常 NULL 在 vcruntime.h(Visual C++ 的一部分)内定义。在依赖于 vcruntime.h 的任何代码(例如 string.h、stdio.h)之前使用自定义 NULL 会导致此错误。删除我们的自定义定义或将其更改为以下内容解决了问题。
In my case, it was using in C++ code a legacy C header containing #define NULL ((void *)0) in some legacy C header. My error message was "C2664 ...cannot convert argument 3 from void * to const_locale_t". The argument in question was NULL. Normally NULL is defined inside vcruntime.h (part of Visual C++). Using the custom NULL before any code that depends on vcruntime.h, like string.h, stdio.h, caused this error. Removing our custom definition or changing it to the following solved the problem.