dymk
dymk

Reputation: 897

SHGetSpecialFolderPath() Not Declared in This Scope

I am not able to compile my program SHGetSpecialFolderPath() not being declared in the scope of the program, while the correct header is being included (according to MSDN) http://msdn.microsoft.com/en-us/library/bb762204(v=vs.85).aspx

Here are the headers for my project:

#include <iostream>
#include <iostream>
#include <windows.h>
#include <algorithm>
#include <vector>
#include <fstream>
#include <direct.h>
#include <shlobj.h>

With error: C:\Users\user\Documents\getAppData\main.cpp|31|error: `SHGetSpecialFolderPath' was not declared in this scope

with shlobj.h being the header with the declaration in it. Any ideas why the compiler is throwing the error? Here is how I am calling the function:

char appData[MAX_PATH];
SHGetSpecialFolderPath( NULL
                        ,appData
                        ,CSIDL_LOCAL_APPDATA
                        ,1 );
cout << appData << endl;

Thanks!

Upvotes: 0

Views: 4782

Answers (1)

Chris Frederick
Chris Frederick

Reputation: 5584

From the MSDN page:

The Microsoft Internet Explorer 4.0 Desktop Update must be installed for this function to be available.

With Windows 2000, this function is superseded by ShGetFolderPath. You can use this function on earlier systems by including the redistributable DLL, ShFolder.dll.

Perhaps this is your problem?

Upvotes: 1

Related Questions