Visual C++:error C2664: 'GetModuleFileNameW' : cannot convert parameter 2 from 'char' to 'LPWCH'
2014-04-12 20:25
1011 查看
A lot of the "functions" of the Windows API are actually macroes to either the ANSI (
be either
If you don't want to compile with Unicode, you can change your project settings to
If you do want to compile with Unicode, then you should append an
A) or Unicode (
Wfor wide) version of the function. Depending on your project settings, these macroes will
be either
DoSomeFunctionAor
DoSomeFunctionWwhen you want to call
DoSomeFunction. The portable way would be then to use
TCHARbecause it is defined as
charfor ANSI and
wchar_tfor Unicode.
If you don't want to compile with Unicode, you can change your project settings to
Project Properties -> Configuration Properties -> General -> Character Set -> Use Multibyte Character Set.
If you do want to compile with Unicode, then you should append an
A(ex:
GetModuleFileNameA) to the necessary function names.
相关文章推荐
- error C2664:cannot convert parameter 2 from 'char [260]' to 'LPWCH'
- 报错 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: 'TextOutW' : cannot convert parameter 4 from const char [5]' to LPCTSTR
- 读ini文件“GetPrivateProfile*”: error C2664:cannot convert parameter 1 from 'const char [12]' to 'LPCWS
- error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'char [20]' to 'LPCWSTR' 原因
- error C2664: 'CWnd::MessageBoxW' : cannot convert parameter 1 from 'char *' to 'LPCTSTR'
- 报错 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: 'MessageBoxW' : cannot convert parameter 2 from 'char [20]' to 'LPCWSTR' 原因
- error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'char [20]' to 'LPCWSTR' 原因
- error C2664: 'atoi' : cannot convert parameter 1 from 'CString' to 'const char *'
- error C2664: 'atof' : cannot convert parameter 1 from 'int' to 'const char *'
- error C2664: 'DeleteFileW' : cannot convert parameter 1 from 'const char *' to 'LPCWSTR'
- 使用Unicode下的cannot convert parameter 1 from 'CString' to 'const char *' 解决办法
- 使用atoi 报错:cannot convert parameter 1 from '_TCHAR *' to 'const char *'
- error C2664: 'cvSetMouseCallback' : cannot convert parameter 2 from ....to'CvMouseback'
- VS2005中报错:cannot convert parameter 2 from 'char *' to 'LPCWSTR'
- VS2010 cannot convert parameter 1 from 'char *' to 'LPCWSTR'
- cannot convert parameter 1 from 'char *' to 'LPCWSTR'