我正在尝试在 Windows 7 的 Visual Studio 2010 中编译一个程序。我在标记行的 Windows 标头中收到编译错误C2061:语法错误:标识符“KNOWN_FOLDER_FLAG” :shlobj.h
#if (NTDDI_VERSION >= 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 >= NTDDI_WIN7)
STDAPI SHGetKnownFolderItem(__in REFKNOWNFOLDERID rfid,
__in KNOWN_FOLDER_FLAG flags, <<<ERROR AT THIS LINE
__in_opt HANDLE hToken,
__in REFIID riid,
__deref_out void **ppv);
#endif // NTDDI_WIN7
在我的程序中,版本宏定义如下
#define NTDDI_VERSION NTDDI_WINXP
它不编译的原因是什么?
在我看来,我得到错误的部分根本不能编译,但它以某种方式编译。