error C2664: 'LONG CTabCtrl::InsertItem(int,TCITEMW *)' : cannot convert parameter 2 from 'char *' t
2017-03-31 11:33
1106 查看
刚刚用vs2005写TAB控件时遇到字符集问题
代码如下:
[cpp]
view plain
copy
print?
m_tab.InsertItem(0,"进程");
m_tab.InsertItem(1,"网络");
m_tab.InsertItem(2,"服务");
m_tab.InsertItem(3,"注册表");
这几段代码在VS2005 编译器提示:
[cpp]
view plain
copy
print?
error C2664: 'LONG CTabCtrl::InsertItem(int,TCITEMW *)' : cannot convert parameter 2 from 'char *' to 'TCITEMW *'
解决方案:
1. vs2005默认工程字符集是unicode,你把他改成无字符集,程序就能编译通过了
2. 或者 m_tab.InsertItem(0,_T("进程"));
修改字符集设置:
项目---> xxx属性 ---> 配置属性---> 常规 ---> 字符集 --->未设置
刚刚用vs2005写TAB控件时遇到字符集问题
代码如下:
[cpp]
view plain
copy
print?
m_tab.InsertItem(0,"进程");
m_tab.InsertItem(1,"网络");
m_tab.InsertItem(2,"服务");
m_tab.InsertItem(3,"注册表");
m_tab.InsertItem(0,"进程"); m_tab.InsertItem(1,"网络"); m_tab.InsertItem(2,"服务"); m_tab.InsertItem(3,"注册表");
这几段代码在VS2005 编译器提示:
[cpp]
view plain
copy
print?
error C2664: 'LONG CTabCtrl::InsertItem(int,TCITEMW *)' : cannot convert parameter 2 from 'char *' to 'TCITEMW *'
error C2664: 'LONG CTabCtrl::InsertItem(int,TCITEMW *)' : cannot convert parameter 2 from 'char *' to 'TCITEMW *'
解决方案:
1. vs2005默认工程字符集是unicode,你把他改成无字符集,程序就能编译通过了
2. 或者 m_tab.InsertItem(0,_T("进程"));
修改字符集设置:
项目---> xxx属性 ---> 配置属性---> 常规 ---> 字符集 --->未设置
相关文章推荐
- error C2664: 'LONG CTabCtrl::InsertItem(int,TCITEMW *)' : cannot convert parameter 2 from 'char *' t
- error C2664: 'atof' : cannot convert parameter 1 from 'int' to 'const char *'
- error C2664: 'CreateThread' : cannot convert parameter 3 from 'int (void *)'
- error:error C2664: 'calc' : cannot convert parameter 2 from 'int' to 'int []' Conversion fro
- error C2664: 'CreateThread' : cannot convert parameter 3 from 'int (void *)'
- error C2664: 'TextOutW' : cannot convert parameter 4 from const char [5]' to LPCTSTR
- error C2664: 'cvSetMouseCallback' : cannot convert parameter 2 from 'void (int,int,int,int,void *)'
- GetWindowTextW(LPTSTR,int) const' :cannot convert parameter 1 from 'char[10]
- error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'char [20]' to 'LPCWSTR' 原因
- error C2664: 'cvSetMouseCallback' : cannot convert parameter 2 from 'void (__cdecl *)(int,int,int,int)' to 'CvMouseCallback' 的解决
- error C2664: 'RtCreateTimer' : cannot convert parameter 3 from 'int (void *)' to 'void (__stdcall *)(void *)'问题解决办法
- Visual C++:error C2664: 'GetModuleFileNameW' : cannot convert parameter 2 from 'char' to 'LPWCH'
- error C2664: 'CreateThread' : cannot convert parameter 3 from 'void (int)' to 'unsigned long (__stdcall *)(void *)'
- _stdcall的说明及error C2664: 'CreateThread' : cannot convert parameter 3 from 'unsigned long (void *)' t
- 报错 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: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: 'MessageBoxW' : cannot convert parameter 2 from 'char [20]' to 'LPCWSTR' 原因
- error C2664: 'cvSetMouseCallback' : cannot convert parameter 2 from 'void (__cdecl *)(int,int,int,int)' to 'CvMouseCallback' 的解决