2011-04-27 43 views
1

我已經定義一個類中的createdirectory(const stdStr& path),我使用Directory::CreateDirectory("C:\\Temp");沒有合適的構造存在,從字符轉換成字符串

訪問從另一個類的功能,我的「C」的\ Temp」的說法,得到一個錯誤「

no suitable constructor exists to convert from "const char [4]" to "std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t>>" 
+0

什麼是stdStr?發佈真正的代碼,所有這些都是相關的。 – 2011-04-27 19:11:22

回答

1

因爲你"C:\\Temp"字符串的char數組,但功能是使用模板上wchar的字符串。就個人而言,我避免像瘟疫一樣的Unicode,但我認爲你需要L"C:\\Temp"(注意前面的L)。

+0

沒有把'L'沒有工作:( – 2011-04-27 18:45:19