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類型了。
錯誤 1 error C2784: “std::_Vb_iterator<_Sizet,_Difft,_MycontTy> std::operator +(_Difft,std::_Vb_iterator<_Sizet,_Difft,_MycontTy>)”: 無法從“WCHAR [260]”爲“std::_Vb_iterator<_Sizet,_Difft,_MycontTy>”推導 模板 參數
2 error 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>”推導 模板 參數
3 error 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了。