我有一個VS2015 C++
項目。應用程序必須在Windows 7和XP上運行。所以,我想設置_WIN32_WINNT
& WINVER
到_WIN32_WINNT_WINXP
。'_WIN32_WINNT'/'WINVER':宏重定義
這是怎麼我的項目stdafx.h
樣子:
stdafx.h中
#pragma once
#include "targetver.h"
#define _WIN32_WINNT _WIN32_WINNT_WINXP
#define WINVER _WIN32_WINNT_WINXP
#include <WinSDKVer.h>
// Windows Header Files:
#include <windows.h>
在編譯時,我看到下面的警告/錯誤:
stdafx.h(12): error C2220: warning treated as error - no 'object' file generated
1>stdafx.h(12): warning C4005: '_WIN32_WINNT': macro redefinition
1> C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\SDKDDKVer.h(197): note: see previous definition of '_WIN32_WINNT'
1>stdafx.h(13): warning C4005: 'WINVER': macro redefinition
1> C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\SDKDDKVer.h(212): note: see previous definition of 'WINVER'
你不需要直接'#定義_WIN32_WINNT」 - 簡單地刪除這個 – RbMm
或添加這一行'#define _CHICAGO_' – RbMm
請看一下targetver.h,按照指示操作。 –