解决方案1:
项目属性——配置属性——常规——字符集:“使用Unicode字符集” 改为 “使用多字节字符集”。
解决方案2:
在网上下了个函数,进行转换:
char* ConvertLPWSTRToLPSTR(LPWSTR lpwszStrIn)
{
LPSTR pszOut = NULL;
if (lpwszStrIn != NULL)
{
int nInputStrLen = wcslen (lpwszStrIn);
// Double NULL Termination
int nOutputStrLen = WideCharToMultiByte (CP_ACP, 0, lpwszStrIn, nInputStrLen, NULL, 0, 0, 0) + 2;
pszOut = new char [nOutputStrLen];
if (pszOut)
{
memset (pszOut, 0x00, nOutputStrLen);
WideCharToMultiByte(CP_ACP, 0, lpwszStrIn, nInputStrLen, pszOut, nOutputStrLen, 0, 0);
}
}
return pszOut;
}
使用时:
cvLoadImage(ConvertLPWSTRToLPSTR(filename), CV_LOAD_IMAGE_COLOR);
最后
以上就是自然巨人最近收集整理的关于cvLoadImage 不能将参数1从 "_TCHAR*" 转换为"const char *"的全部内容,更多相关cvLoadImage内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复