I am writing a C++ desktop app for Windows 7 and later.
I want to get the path to the AppData/Roaming folder so I use SHGetKnownFolderPath:
#include "stdafx.h"
#include <windows.h>
#include <ShlObj.h>
void hello()
{
LPWSTR roamingPath;
SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, NULL, &roamingPath);
PROBLEM: Build fails with identifier "SHGetKnownFolderPath" is undefined
, which is strange as I think I included the right headers.
Notes:
- Visual Studio 2015 tells me that my compile options are
/Yu"stdafx.h" /GS /analyze- /W3 /Zc:wchar_t /ZI /Gm /Od /Fd"Debug\vc140.pdb" /Zc:inline /fp:precise /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_USRDLL" /D "_WINDLL" /D "_MBCS" /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /Oy- /MDd /Fa"Debug\" /EHsc /nologo /Fo"Debug\" /Fp"Debug\OverlayIcon.pch"
. - Different from Error: identifier :"SHGetKnownFolderPath" is unidentified where the problem is that the asker targets more than desktop.