VS2008 不能将参数 1 从“const char [10]”转换为“const wchar_t *”

作者:Chilau 发布于:2012-8-26 14:16 分类:troubleshoting

出错处:
CString strConnect;
strConnect.Format(_T("DSN=Hotel;"));
该代码在vc6.0上是没有问题的,在vs2008上就出现上面的问题,解决方法:
解决方法:字符集问题,VC6工程默认是多字节的,VS2008默认是Unicode的。
如:
Format ("%s",str);

修改为:
Format (L"%s",str)或Format (_T("%s"),str)就可以了。

2.       "无法从“const char [11]”转换为“ATL::CStringT<BaseType,StringTraits>”"
解决方法:先定义,另外赋值。
如:CString str = "模式对话框";
修改为:CString str;str = "模式对话框";或CString str("模式对话框");就可以了。



« Gitweb使用自签名SSL证书提示error: SSL certificate problem解决方案 | 记给apache加php支持»

发表评论: