解决错误 This file requires _WIN32_WINNT to be #defined at least to 0x0403. ..

看网上下载的代码,自己用vs2010打开,生成一个solution ,编译的时候出现错误:
Error 1 error C1189: #error :  This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher is recommended. c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atlcore.h 35
双击错误定位到atlcore.h的一下语句:
#if _WIN32_WINNT < 0x0403
#error This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher is recommended.
#endif
因为搞不懂,上网查一查,有人说预编译加一句 #define _WIN32_WINNT 0x0501,但是试了,还是不行。然后又查到一下方法。
首先看看工程中是否包含targetver.h这个头文件,如果没有的话,新建一个这个文件,文件内容如下:

#pragma once

// Including SDKDDKVer.h defines the highest available Windows platform.

// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.

#include <SDKDDKVer.h>

接下来,在stdafx.h中包含这个文件 #include "targetver.h".编译一下没有错误。
至于为什么出现这个错误,以及问什么这么解决,暂时还不清楚。

<script type=text/javascript charset=utf-8 src="http://static.bshare.cn/b/buttonLite.js#style=-1&uuid=&pophcol=3&lang=zh"></script> <script type=text/javascript charset=utf-8 src="http://static.bshare.cn/b/bshareC0.js"></script>
阅读(104) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值