安装Visual Studio 2010后出现错误C1189

Kra*_*mig 18 c++ visual-studio-2010

我在驱动器崩溃后安装了VS2010,之前我有VS2005,一切都很好.

现在编译一个以前很好的C++应用程序我看到了一些我无法弄清楚的错误.

错误1错误C1189:#error:此文件要求_WIN32_WINNT #defined至少为0x0403.建议值为0x0501或更高.C:\ Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include\atlcore.h 35 1 BIOXGINA

#ifndef __ATLCORE_H__
#define __ATLCORE_H__

#pragma once

#ifdef _ATL_ALL_WARNINGS
#pragma warning( push )
#endif

#pragma warning(disable: 4786) // identifier was truncated in the debug information
#pragma warning(disable: 4127) // constant expression

#include <atldef.h>
#include <windows.h>
#include <ole2.h>

#include <limits.h>
#include <tchar.h>
#include <mbstring.h>

#include <atlchecked.h>
#include <atlsimpcoll.h>

34.  #if _WIN32_WINNT < 0x0403
35.  #error This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher is recommended.
36.  #endif

#pragma pack(push,_ATL_PACKING)
namespace ATL
{
/////////////////////////////////////////////////////////////////////////////
// Verify that a null-terminated string points to valid memory
inline BOOL AtlIsValidString(
_In_z_count_(nMaxLength) LPCWSTR psz,
_In_ size_t nMaxLength = INT_MAX)
{
(nMaxLength);
return (psz != NULL);
}
Run Code Online (Sandbox Code Playgroud)

如果我评论出以上几行,我就可以了

错误C3861标识符未在下面第111行找到.

我认为我只是得到这个,因为我评论了以上几行?

HRESULT Init() throw()
{
    HRESULT hRes = S_OK;

111.        if (!InitializeCriticalSectionAndSpinCount(&m_sec, 0))
    {
        hRes = HRESULT_FROM_WIN32(GetLastError());
    }

    return hRes;
}
Run Code Online (Sandbox Code Playgroud)

我将不胜感激.真的不想重新安装2005.

p.c*_*ell 24

Microsoft Connect问题具有以下潜在解决方案:

编辑文件"stdafx.h"并将_WIN32_WINNT和WINVER定义的值更改为0x0502.

有关MSDN C++论坛上错误的更多讨论:旧版VC解决方案存在问题.


Bo *_*son 5

您的项目的目标是较新的编译器(或其他任何东西)不再支持的Windows版本.

您必须选择Windows XP("Windows 5")或更高版本的最低目标版本.