PathCombineW gives unresolved exetranl symbol

The error is in PathCombine but I can't find the solution to the error. I also included the function for getting roaming dir.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Severity    Code    Description Project File    Line    Suppression State
Error   LNK2019 unresolved external symbol __imp_PathCombineW referenced in function "wchar_t * __cdecl CombineDirectory(wchar_t,wchar_t)" (?CombineDirectory@@YAPEA_W_W0@Z)    Janus   G:\Programming\C++\Janus\Janus\Main.obj 1   


wchar_t* GetDirectoryRoaming()
{
    wchar_t* pathbuffer;
    SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, NULL, &pathbuffer);
    return pathbuffer;
}

wchar_t* CombineDirectory(const wchar_t fAddress, const wchar_t sAddress)
{
    wchar_t* MainDirectory = L"Program\\"; //Main folder name.
    wchar_t* Roaming = GetDirectoryRoaming(); //

    wchar_t* bufferpointer = new wchar_t [MAX_PATH];

    PathCombine(bufferpointer, Roaming, MainDirectory);//STORE PATH IN PROGRAM_FOLDER.
    return bufferpointer;
}
Last edited on
You need to add the library Shlwapi.lib to your project.

In Visual Studio you can use #pragma comment(lib, "Shlwapi.lib")
Topic archived. No new replies allowed.