I wanted to make a simple program for classifying files by their extensions, but when tried to compile got the error
Severity Code Description Project File Line Error LNK2019 unresolved external symbol __imp__PathFileExistsW@4 referenced in function "void __cdecl classifyFiles(void)" (?classifyFiles@@YAXXZ)
My code is where PathFileExists is called is this:
void classifyFiles() {
for (int i = 0; i < files.max_size(); i++) {
//if each folder doesn't exist, create folder
LPCWSTR folderName = (L"\\" + extensions.at(i)).c_str();
if (!PathFileExistsW(folderName)) {
CreateDirectory(folderName, NULL);
};
LPCWSTR destination = (extensions.at(i) + files.at(i)).c_str();
//move file
MoveFile(files.at(i).c_str(), destination);
}
}
I googled a little and it seems it is not enough with including the Shlwapi.h
header and also need to link the library. But I can't find any answer about how to do it in Visual Studio.
Note: I am also having problem finding were are each menu and everything (this is my first time with Visual Studio), so please make it clear where to find what and if possible include screenshots.
References: https://msdn.microsoft.com/en-us/library/windows/desktop/bb773584(v=vs.85).aspx