Unicode Character与Multi-Byte Character
2008-11-13 13:40
编译时出现很多错误:
d:/visual studio 2008/projects/teapot/teapot/d3dutility.cpp(37) : error C2440: '=' : cannot convert from 'const char [13]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast d:/visual studio 2008/projects/teapot/teapot/d3dutility.cpp(41) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [25]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast d:/visual studio 2008/projects/teapot/teapot/d3dutility.cpp(49) : error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'const char [13]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast d:/visual studio 2008/projects/teapot/teapot/d3dutility.cpp(53) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [24]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast d:/visual studio 2008/projects/teapot/teapot/d3dutility.cpp(73) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [27]' to 'LPCWSTR'
解决方法如下:
中文版VC++2005(8.0):项目->属性->配置属性->常规->字符集:把使用 Unicode 字符集改成使用多字节字符集
英文版VC++2008(9.0):Project->Properties->General->Character Set:将Use Unicode Character Set改为Use Multi-Byte Character Set
|