無法從“WCHAR [260]”爲“std::_Vb_iterator”推導 模板 參數

	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了。
發佈了42 篇原創文章 · 獲贊 1 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章