title: C++ WinSDK header compilation error
body: <p>I am trying to compile a program in Visual Studio 2010 in Windows 7. I am getting a compilation error <strong>C2061: syntax error: identifier 'KNOWN_FOLDER_FLAG'</strong> in Windows header <code>shlobj.h</code> at the marked line:</p>
  
  <pre><code>#if (NTDDI_VERSION &gt;= NTDDI_VISTA)
  
  typedef enum
  {
      KF_FLAG_DEFAULT         = 0x00000000,
      KF_FLAG_CREATE          = 0x00008000,
      KF_FLAG_DONT_VERIFY     = 0x00004000,
      KF_FLAG_DONT_UNEXPAND   = 0x00002000,
      KF_FLAG_NO_ALIAS        = 0x00001000,
      KF_FLAG_INIT            = 0x00000800,
      KF_FLAG_DEFAULT_PATH    = 0x00000400,
      KF_FLAG_NOT_PARENT_RELATIVE = 0x00000200,
      KF_FLAG_SIMPLE_IDLIST   = 0x00000100,
      KF_FLAG_ALIAS_ONLY      = 0x80000000,
  } KNOWN_FOLDER_FLAG;
  
  
  DEFINE_ENUM_FLAG_OPERATORS(KNOWN_FOLDER_FLAG);
  
  STDAPI SHGetKnownFolderIDList(__in REFKNOWNFOLDERID rfid,
                                __in DWORD /* KNOWN_FOLDER_FLAG */ dwFlags,
                                __in_opt HANDLE hToken,
                                __deref_out PIDLIST_ABSOLUTE *ppidl);
  
  STDAPI SHSetKnownFolderPath(__in REFKNOWNFOLDERID rfid,
                              __in DWORD /* KNOWN_FOLDER_FLAG */ dwFlags,
                              __in_opt HANDLE hToken,
                              __in PCWSTR pszPath);
  
  STDAPI SHGetKnownFolderPath(__in REFKNOWNFOLDERID rfid,
                              __in DWORD /* KNOWN_FOLDER_FLAG */ dwFlags,
                              __in_opt HANDLE hToken,
                              __deref_out PWSTR *ppszPath);
  
  #endif  // NTDDI_VISTA
  
  #if (NTDDI_VERSION &gt;= NTDDI_WIN7)
  
  STDAPI SHGetKnownFolderItem(__in REFKNOWNFOLDERID rfid,
                              __in KNOWN_FOLDER_FLAG flags, &lt;&lt;&lt;ERROR AT THIS LINE
                              __in_opt HANDLE hToken,
                              __in REFIID riid,
                              __deref_out void **ppv);
  #endif // NTDDI_WIN7
  </code></pre>
  
  <p>In my program the version macros is defined as folows</p>
  
  <pre><code>#define NTDDI_VERSION NTDDI_WINXP
  </code></pre>
  
  <p>What can be the reason for it not to compile?</p>
  
  <p>It seems to me that the part I am getting the error in must not be compiled at all, but it somehow does.</p>