无法从“WCHAR [260]”为“std::_Vb_iterator<_Sizet,_Difft,_MycontTy>”推导 模板 参数

时间:2022-05-10 04:21:02
WIN32_FIND_DATA wfd;
....
std::string filename=file_PathName.substr(0,file_PathName.find_last_of("\\")+1)+wfd.cFileName;


wfd.cFileName格式错误,WCHAR不能直接转换为string,使用多字节字符集就变成CHAR类型转string类型了。
 
错误1error C2784: “std::_Vb_iterator<_Sizet,_Difft,_MycontTy> std::operator +(_Difft,std::_Vb_iterator<_Sizet,_Difft,_MycontTy>)”: 无法从“WCHAR [260]”为“std::_Vb_iterator<_Sizet,_Difft,_MycontTy>”推导 模板 参数2error C2784: “std::_Vb_const_iterator<_Sizet,_Difft,_MycontTy> std::operator +(_Difft,std::_Vb_const_iterator<_Sizet,_Difft,_MycontTy>)”: 无法从“WCHAR [260]”为“std::_Vb_const_iterator<_Sizet,_Difft,_MycontTy>”推导 模板 参数3error C2784: “std::_Vector_iterator<_Ty,_Alloc> std::operator +(_Vector_iterator<_Ty,_Alloc>::difference_type,std::_Vector_iterator<_Ty,_Alloc>)”: 无法从“WCHAR [260]”为“std::_Vector_iterator<_Ty,_Alloc>”推导 模板 参数
我的程序出现这个错误的原因是, 属性>配置属性>常规>使用unicode字符集,改为使用多字节字符集,就OK了。