`
kevin_hust
  • 浏览: 12270 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

error C1189:#error:This file requires _WIN32_WINNT to be #defined at least to 0x

阅读更多
原作者所写系统环境不清楚,在win7与VS2010上使用不兼容,出现错误,如图所示




--------------------解决办法-----------------

第1步:

查找stdafx.h头文件(一般头文件定义都在这里,首选就是找这里),结果如上图所示,一共4段---->前3段是关于系统的(干涉,此处就是系统不兼容,所以全部注释掉),最后1段是讲IE的(不干涉,默认处理)

第2步:

旧版本第1步删除了,新版本怎样添加呢?---->查找MSDN2010版本的(本地的之前装了,不过不小心删除后就一直没用了,现介绍网上的MSDN,网址如下:http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=ZH-CN&k=k(MSDNSTART)&rd=true,或者直接输入MSDN.com也可以

然后查找"修改 WINVER 和 _WIN32_WINNT"--->网址是这个:http://msdn.microsoft.com/zh-cn/library/6sehtctf(VS.90).aspx,不想或不会查找也可以,直接看截图,如图所示:


--------------这些资料都是来自官网,现在应该知道错误原因了吧,第3步,就直接告诉你方法---------------

第3步:解决方法

步骤1:注释前3段

步骤2:增加1段(有2种方法:1种是MSDN上的,1种是兼容版的模式,2种都可以用,第2种兼容模式是供参考的材料)

------------------第1种方法------------------

#define WINVER 0x0500
#define _WIN32_WINNT 0x0500


------------------第2种方法------------------写法是摘抄兼容模式的写法,供以后兼容性做的参考提供,另外上面的图中提供了更多兼容模式,当然也保存了下来,详见最后的备注

#ifndef WINVER 0x0500
#define _WIN32_WINNT 0x0500
#endif


备注1:源代码,方便复制用

-----------------------------------分2部分:第1部分:老版本 第2部分:新版本----------------------------------------

----------------------------------第1部分:老版本--------------------------------------

// 如果您必须使用下列所指定的平台之前的平台,则修改下面的定义。
// 有关不同平台的相应值的最新信息,请参考 MSDN。
#ifndef WINVER     // 允许使用 Windows 95 和 Windows NT 4 或更高版本的特定功能。
#define WINVER 0x0400   //为 Windows98 和 Windows 2000 及更新版本改变为适当的值。
#endif

#ifndef _WIN32_WINNT   // 允许使用 Windows NT 4 或更高版本的特定功能。
#define _WIN32_WINNT 0x0400   //为 Windows98 和 Windows 2000 及更新版本改变为适当的值。
#endif    

#ifndef _WIN32_WINDOWS   // 允许使用 Windows 98 或更高版本的特定功能。
#define _WIN32_WINDOWS 0x0410 //为 Windows Me 及更新版本改变为适当的值。
#endif

#ifndef _WIN32_IE    // 允许使用 IE 4.0 或更高版本的特定功能。
#define _WIN32_IE 0x0400 //为 IE 5.0 及更新版本改变为适当的值。
#endif

----------------------------------第2部分:新版本--------------------------------------

// 如果您必须使用下列所指定的平台之前的平台,则修改下面的定义。
// 有关不同平台的相应值的最新信息,请参考 MSDN。
#ifndef WINVER     // 允许使用特定于 Windows XP 或更高版本的功能。
#define WINVER 0x0501   // 将此值更改为相应的值,以适用于 Windows 的其他版本。
#endif

#ifndef _WIN32_WINNT   // 允许使用特定于 Windows XP 或更高版本的功能。
#define _WIN32_WINNT 0x0501 // 将此值更改为相应的值,以适用于 Windows 的其他版本。
#endif     

#ifndef _WIN32_WINDOWS   // 允许使用特定于 Windows 98 或更高版本的功能。
#define _WIN32_WINDOWS 0x0410 // 将它更改为适合 Windows Me 或更高版本的相应值。
#endif

#ifndef _WIN32_IE    // 允许使用特定于 IE 6.0 或更高版本的功能。
#define _WIN32_IE 0x0600 // 将此值更改为相应的值,以适用于 IE 的其他版本。值。
#endif

一共2种版本,新版本是在最近的例子中找出来的
备注2:另外本次在查找MSDN中,也发现了一个问题,比如刚才查找的C1189,MSDN上就介绍的很好.顺着这个线索,你可以发现MSDN中关于错误代号的解释非常详细.当然本地安装的MSDN上也有(推荐用网上的MSDN),效果如图


附注1:

#define WINVER 0x0400之类定义
写了,反而错误都来了.版本写高了,放到低版本上又说高了,写低了,放到高版本上又说低了.(上面有2种版本的代码)
啥都不写,一点错也没有-------------------->还待更多实例验证

据说是MFC类向导自动生成(机器写的),不用用户定义,这些宏是管理MFC,ATL哪些函数能使用,哪些函数调用哪些DLL,哪函数函数的功能无效的.

写这的作用:从字面上就能看出是版本兼容问题,当然MSDN上也确定是版本问题(可以查MSDN了解版本代号)

有2个办法可以解决.1个是直接删除,1个是修改到合适版本
------>至于选哪个办法合适,仅仅目前的1,2个例子无法说明问题,待以后例子多时,在来跟踪总结
分享到:
评论

相关推荐

    c++0x, c++11的解决办法 error: #error "Qt requires C++11 support

    error: #error "Qt requires C++11 support c++0x, c++11的解决办法 如果你是用makefile编译还好解决些,但是如果你是用CMake编译,你还得变成CMake的写法. 不过低层原理都一样,都是在g++上作文章. 我来告诉你makefile...

    netcon.h头文件

    #error this stub requires an updated version of #endif // __RPCNDR_H_VERSION__ #ifndef COM_NO_WINDOWS_H #include "windows.h" #include "ole2.h" #endif /*COM_NO_WINDOWS_H*/ #ifndef __netcon_h__ #...

    头文件免费下载

    // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #if !defined(AFX_STDAFX_H__C4B5DA9B_21...

    emulator: ERROR: x86 emulation currently requires hardware acceleration!

    NULL 博文链接:https://zzc1684.iteye.com/blog/2237179

    #GDC2018 FINAL FANTASY XV_Behind_the_Scene_GDC2018.pdf

    Doing this requires detailed analysis of the game engine to come up with a list of technologies which would naturally fit into existing content. The existing game was already very high fidelity. With...

    Zedboard板基于SOC的Adau1761测试项目

    ERROR: [BD 41-701] connect_bd_net requires at least two pins/ports, or one pin/port and a net ERROR: [BD 5-4] Error: running connect_bd_net. ERROR: [Common 17-39] 'connect_bd_net' failed due to ...

    ApkIDE3.3.0.0作者原版,解决常见apk打包安装问题.rar

    adb: failed to install SystemActivities.apk: Failure [INSTALL_FAILED_OLDER_SDK: Failed parse during installPackageLI: /data/app/vmdl1716187195.tmp/base.apk (at Binary XML file line #0): Requires newer...

    This application requires Visual Studio 2013 Redistributable.

    MySql5.7.20安装过程中报错 This application requires Visual Studio 2013 Redistributable. Please install the Redistributable then run this installer again. 的解决办法.报错如下: 1: Action 10:59:21: ...

    Android代码-gradle-errorprone-plugin

    This plugin requires using at least Gradle 4.6. While JDK 8 is supported, it is recommended to use at least a JDK 9 compiler. See note below about JDK 8 support. Usage plugins { id(...

    ioncube_loader_win_5.2.dll的错误解决方法

    requires the ionCube PHP Loader ioncube_loader_win_5.2.dll to be installed by the site administrator 我们现在主要的就是需要安装和找模块 下载地址http://www.ioncube.com/loaders.php在这里下载对应的模块 ...

    Unix 编程常见问题解答(中文版)

    回答了在unix的C编程中容易碰到的问题和编程经验,包含进程控制、一般文件操作、终端输入/输出、系统信息和编程杂技等等,是不可多得的好资料

    Pytorch训练过程中改变模型参数 requires_grad 属性

    如果模型只在一块GPU上跑,该过程非常简单,只需要训练中途迭代model的 parameters,然后改变各个param的requires_grad 属性即可: for name, param in model.named_parameters(): logger.info('parameter of %s'...

    k7 SRIO参考例程

    Core name: Xilinx LogiCORE ... - Destination Operations CAR (offset 0x1C) - Switch Route Table Destination ID Limit CAR (offset 0x34) - Core does not have functionality to enable the user to drop...

    sun_sun_nosun:game_files_requires_renpy_to_run

    sun_sun_nosun

    Google C++ Style Guide(Google C++编程规范)高清PDF

    The definition of an inline function needs to be in a header file, so that the compiler has the definition available for inlining at the call sites. However, implementation code properly belongs in ....

    memcached 1.2.6 1.2.5

    win32: libevent-1.4.4-stable-win32.zip patch: libevent-1.4.4.diff Apply the patch using a command line like: patch -E -p 1 -i libevent.diff memcached 1.2.5 The original is the version from the ...

    CPP-Win32-Bitmap-Water-Effect-DLL:Win32 32bpp与设备无关的位图(DIB)Water Effect DLL

    CPP-Win32-位图-水效果DLLAutoHotkey v2示例( ) :warning: 需要一个32bpp的独立于设备的位图(DIB)。 ; https://www.autohotkey.com/# Requires AutoHotkey v2 .0 - a129 - 78d2aa15# DllLoad waterfx.dllglobal ...

    php.ini-development

    Windows directory (C:\windows or C:\winnt) ; See the PHP docs for more specific information. ; http://php.net/configuration.file ; The syntax of the file is extremely simple. Whitespace and lines ; ...

    au3反编译源码

    *.tok AutoIt Tokenfile (use myAutToExe to transform this into an au3 File) *.au3 *.tbl Contains ScriptStrings - Goes together with an VanZande-obfucated script. Files ===== myAutToExe.exe ...

    win 3.11 for workgroup tcpip支持

    This may be followed by ipconfig /renew to get a new address. ARP Conflicts - Report to DHCP Server Administrator --------------------------------------------------- Before the TCP/IP stack comes up ...

Global site tag (gtag.js) - Google Analytics