error C2664:cannot convert parameter 2 from 'char [260]' to 'LPWCH'
2013-07-30 10:05
531 查看
编译环境:Windows XP + VS2008
在VC6中可以编译成功的代码在VS2005,VS2008中编译出错。
原因:LPWCH是指long pointer to wide char,VS2005和2008默认使用unicode编码,而vc6默认使用多字节编码。
解决方法:
(1)将char改为wchar_t,但是会引起很多问题(在既有代码中)
(2)在项目的属性>配置属性>常规中,将“字符集”由“使用Unicode字符集”改为“使用多字节字符集”
转自:http://blog.sina.com.cn/s/blog_78fd98af0100ya79.html
在VC6中可以编译成功的代码在VS2005,VS2008中编译出错。
原因:LPWCH是指long pointer to wide char,VS2005和2008默认使用unicode编码,而vc6默认使用多字节编码。
解决方法:
(1)将char改为wchar_t,但是会引起很多问题(在既有代码中)
(2)在项目的属性>配置属性>常规中,将“字符集”由“使用Unicode字符集”改为“使用多字节字符集”
转自:http://blog.sina.com.cn/s/blog_78fd98af0100ya79.html
相关文章推荐
- 报错 error C2664: 'CreateWindowExA' : cannot convert parameter 2 from 'unsigned short [10]' to 'const char *'
- error C2664: 'CWnd::MessageBoxW' : cannot convert parameter 1 from 'char *' to 'LPCTSTR'的解决方法
- error C2664: 'CWnd::MessageBoxW' : cannot convert parameter 1 from 'char *' to 'LPCTSTR'的解决方法
- error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'char [20]' to 'LPCWSTR' 原因
- error:cannot convert parameter 1 from 'unsigned char *' to 'char *'
- error C2664: 'cvSetMouseCallback' : cannot convert parameter 2 from 'void (__cdecl *)(int,int,int,int)' to 'CvMouseCallback' 的解决
- Visual C++:error C2664: 'GetModuleFileNameW' : cannot convert parameter 2 from 'char' to 'LPWCH'
- error C2664: 'CWnd::MessageBoxW' : cannot convert parameter 1 from 'const char [30]' to 'LPCTSTR'
- error C2664: 'CWnd::FromHandle' : cannot convert parameter 1 from 'unsigned long' to 'HWND'
- 用VC创建新线程易出的问题error C2664: 'CreateThread' : cannot convert parameter 3 from 'unsigned long (void *)' to 'unsigned long (__stdcall
- 'LoadLibraryW' : cannot convert parameter 1 from 'const char *' to 'LPCWSTR' 解决方案
- vs2008下cannot convert parameter 1 from 'LPCTSTR' to 'const char *'的解决方法
- Unicode字符集与多字节字符集的比较(解决“cannot convert parameter 1 from 'char []' to 'LPCWSTR'”)
- LoadCursorA' : cannot convert parameter 2 from 'const int' to 'const char *
- cannot convert parameter 1 from 'const char *' to 'LPCWSTR
- error C2664: 'RtCreateTimer' : cannot convert parameter 3 from 'int (void *)' to 'void (__stdcall *)(void *)'问题解决办法
- error C2664: 'CreateThread' : cannot convert parameter 3 from 'unsigned long (void *)' to 'unsigned long (__stdcall *)(void *)'
- cannot convert parameter 5 from 'char [64]' to 'unsigned char *解决办法
- error C2664: 'cvSetMouseCallback' : cannot convert parameter 2 from 'void (__cdecl *)(int,int,int,int)' to 'CvMouseCallback' 的解决
- error:error C2664: 'calc' : cannot convert parameter 2 from 'int' to 'int []' Conversion fro