8

VS2010(windows xp)でMFCプロジェクトを作成します。そして、私はこのエラーを取ります:

error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x0500. Value 0x0501 or higher is recommended. 

afxcomctl32.h:を追加した場合#define _WIN32_WINNT 0x0501、60以上のエラーが発生します。プロジェクトでは何も追加しません。作成したVisualStudioなどを使用します。私はこれで何をする必要がありますか?

4

4 に答える 4

23

afxcomctl32.hは間違った場所だと思います。この問題を修正するには、stdafx.hを次のようにします。

// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER                // Allow use of features specific to Windows 95 and Windows NT 4 or later.
#define WINVER 0x0501        // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif

#ifndef _WIN32_WINNT        // Allow use of features specific to Windows NT 4 or later.
#define _WIN32_WINNT 0x0501        // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif                        

#ifndef _WIN32_WINDOWS        // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0501 // Change this to the appropriate value to target Windows Me or later.
#endif

#ifndef _WIN32_IE            // Allow use of features specific to IE 4.0 or later.
#define _WIN32_IE 0x0500    // Change this to the appropriate value to target IE 5.0 or later.
#endif
于 2013-02-01T10:15:27.100 に答える
3

これをStdAfx.hファイルのTOPに追加してみてください。

#include <sdkddkver.h>

私のアプリケーションでは、私は定義しています

_WIN32_WINNT=_WIN32_WINNT_WINXP

最初は同じ問題がありました。MFCを使用する場合、windows.hを含めることが許可されていないため、_WIN32_WINNT_WINXPが定義されておらず、_WIN32_WINNTに有効な値がないことがわかりました。windows.hがそれらの値を定義するために使用するヘッダー(sdkddkver.h)を含めることにより、突然すべてが機能します!

Blech。私はWindowsのプログラミングが嫌いです。

于 2013-10-19T00:44:32.620 に答える
1

afxcomctl32.hを変更する必要はありません。このファイルの前にWindows.hを含める必要があります。

動作するはずです。

于 2013-02-01T10:30:49.447 に答える
0

私は自分の問題を解決しました。事実、ファイルatmcore.hはVS2010の標準とは異なっていました。

于 2013-02-01T13:32:20.820 に答える