0

as per msdn, I am supposed to include "Shlobj.h" for CSIDL_COMMON_APPDATA to run, but I am still getting error C2065: 'CSIDL_COMMON_APPDATA' : undeclared identifier the line that causes the error is

if (SUCCEEDED(SHGetSpecialFolderPathA(NULL,szPath,CSIDL_COMMON_APPDATA,FALSE)))

can any one help? I am coding in vc++ using Visual Studio 6.0

SheetJS
  • 22,470
  • 12
  • 65
  • 75
vin
  • 869
  • 4
  • 17
  • 33
  • If you open shlobj.h is CSIDL_COMMON_APPDATA actually defined? – snowdude Jul 04 '13 at 11:41
  • yes that's exactly what msdn says! – vin Jul 04 '13 at 11:43
  • I know that's what it says but just to ensure you have the correct version of shlobj.h you should open it and validate that the #define is there. It should read: #define CSIDL_COMMON_APPDATA 0x0023 – snowdude Jul 04 '13 at 11:46
  • well I did that, this is what the line in shlobj.h reads '#define CSIDL_COMMON_APPDATA 35' – vin Jul 04 '13 at 11:48
  • Is there a conditional define above it, e.g. #if (NTDDI_VERSION >= NTDDI_VISTA)? – snowdude Jul 04 '13 at 11:53

1 Answers1

0

Looks like you have an invalid (or old) version of shlobj.h. Download the latest SDK from Microsoft and it will have the latest version of that file:

http://www.microsoft.com/en-gb/download/details.aspx?id=8279

snowdude
  • 3,854
  • 1
  • 18
  • 27
  • do you think that's a good idea? wont it hamper any other functionalities? – vin Jul 04 '13 at 11:59
  • I posted that answer before you corrected your comment on what your CSIDL_COMMON_APPDATA was defined as. Try moving the shlobj.h include to the top of the CPP file and see if that helps. – snowdude Jul 04 '13 at 12:03