static void GetFilesFromDir(std::string dir, std::vector<std::string>& items)
{
WIN32_FIND_DATA findData;
HANDLE hFind=FindFirstFile((dir+"\\*").c_str(), &findData); //1 error
do
{
if(hFind != INVALID_HANDLE_VALUE)
{
std::string sFileName = findData.cFileName; //2 error
LPCSTR lp(sFileName.c_str());
if(sFileName == "." || sFileName == "..")
{} //do nothing
else if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
GetFilesFromDir(dir+"\\"+sFileName, items);
else
items.push_back(dir+"\\"+sFileName);
}
} while (FindNextFile(hFind, &findData));
}
これが、別のプロジェクトから新しいプロジェクトにコピーした単純な関数です。そして、特に他のプロジェクトで機能するため、私が考えることができる理由もなくエラーがスローされます...
1>c:\users\prog\documents\visual studio 2010\projects\vampire stealth\vampire stealth\smallfunctions.h(22): error C2664: 'FindFirstFileW' : cannot convert parameter 1 from 'const char *' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\users\prog\documents\visual studio 2010\projects\vampire stealth\vampire stealth\smallfunctions.h(27): error C2440: 'initializing' : cannot convert from 'WCHAR [260]' to 'std::basic_string<_Elem,_Traits,_Ax>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> No constructor could take the source type, or constructor overload resolution was ambiguous
誰かが何が悪いのかについて何か考えがありますか?私はそれについて全く無知です。