本打算了解一下纤程内容,在试图使用 ConvertThreadToFiber的时候,编译总是出错,提示信息如下:error C2065: 'ConvertThreadToFiber' : undeclared identifier,编译器告诉我“函数未声明”。于是转而查看MSDN,有内容如下:

Requirements:

Windows NT/2000: Requires Windows NT 3.51 SP3 or later.
Windows 95/98: Requires Windows 98.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.

但明明已经#include <Windows.h>了。不得已,又经Windows.h进入Winbase.h中,查看源码,见声明之前有条件编译语 句:#if(_WIN32_WINNT >= 0x0400),由此发现我的程序并没有声明宏_WIN32_WINNT。最终在StdAfx.h文件的#include <windows.h>语句之前添加语句:

#define _WIN32_WINNT 0x0400

编译通过。

理解_WIN32_WINNT的作用:

需要你自已在stdafx.h头文件中定义。编译器根据此宏来确定windows的版本,如果你需要使用高版本的WIN32函数,只有你定义了此宏后才能使用
    
Windows   XP                                      _WIN32_WINNT>=0x0501    
Windows   2000                                   _WIN32_WINNT>=0x0500    
Windows   NT   4.0                               _WIN32_WINNT>=0x0400    
Windows   Me                                      _WIN32_WINDOWS=0x0490    
Windows   98                                      _WIN32_WINDOWS>=0x0410    
Internet   Explorer   6.0                         _WIN32_IE>=0x0600    
Internet   Explorer   5.01,   5.5                _WIN32_IE>=0x0501    
Internet   Explorer   5.0,   5.0a,   5.0b        _WIN32_IE>=0x0500    
Internet   Explorer   4.01                       _WIN32_IE>=0x0401    
Internet   Explorer   4.0                        _WIN32_IE>=0x0400    
Internet   Explorer   3.0,   3.01,   3.02        _WIN32_IE>=0x0300

PS:当然也可以在程序的C++的预处理器中设置。

------------------------------------------------------------------------

MSDN中的描述

Using   the   SDK   Headers  
   
  This   version   of   the   Microsoft&reg;   Platform   SDK   enables   you   to   create   applications   that   run   on   Microsoft   Windows&reg;   95,   Microsoft   Windows   NT&reg;   4.0,   Windows&reg;   98,   Windows   Millennium   Edition   (Windows   Me),   Windows   2000,   Windows   XP,   and   Windows   .NET   Server   2003   family.   You   can   also   create   64-bit   applications.   The   header   files   use   data   types   that   allow   you   to   build   both   32-   and   64-bit   versions   of   your   application   from   a   single   source   code   base.   For   more   information,   see   Getting   Ready   for   64-bit   Windows.  
   
   
  Microsoft&reg;   Visual   C++&reg;   includes   content   from   the   edition   of   the   Platform   SDK   that   was   current   at   the   time   Visual   C++   was   released.   Therefore,   if   you   install   the   latest   Platform   SDK,   you   may   end   up   with   multiple   versions   of   the   same   header   files   on   your   computer.   To   ensure   that   you   are   using   the   latest   version   of   the   SDK   header   files,   follow   the   directions   included   in   Installing   the   Platform   SDK   with   Visual   Studio.   Otherwise,   you   will   receive   the   following   error   when   compiling   code   that   uses   features   that   were   introduced   after   Visual   C++   was   released:   error   C2065:   undeclared   identifier.  
   
  Certain   functions   that   depend   on   a   particular   version   of   Windows   are   declared   using   conditional   code.   This   enables   you   to   use   the   compiler   to   detect   whether   your   application   uses   functions   that   are   not   supported   on   its   target   version(s)   of   Windows.   To   compile   an   application   that   uses   these   functions,   you   must   define   the   appropriate   macros.   Otherwise,   you   will   receive   the   C2065   error   message.   The   following   table   indicates   the   macros   you   must   define   to   target   each   system.  
   
  Minimum   system   required   Macros   to   define    
  Windows   .NET   Server   2003   family   _WIN32_WINNT>=0x0502    
  Windows   XP   _WIN32_WINNT>=0x0501    
  Windows   2000   _WIN32_WINNT>=0x0500    
  Windows   NT   4.0   _WIN32_WINNT>=0x0400    
  Windows   Me   _WIN32_WINDOWS=0x0490    
  Windows   98   _WIN32_WINDOWS>=0x0410    
  Internet   Explorer   6.0   _WIN32_IE>=0x0600    
  Internet   Explorer   5.01,   5.5   _WIN32_IE>=0x0501    
  Internet   Explorer   5.0,   5.0a,   5.0b   _WIN32_IE>=0x0500    
  Internet   Explorer   4.01   _WIN32_IE>=0x0401    
  Internet   Explorer   4.0   _WIN32_IE>=0x0400    
  Internet   Explorer   3.0,   3.01,   3.02   _WIN32_IE>=0x0300    
   
   
  For   example,   to   use   the   features   specifically   marked   for   Windows   2000   in   the   header   files,   you   need   to   explicitly   define   _WIN32_WINNT   as   0x0500   or   greater.   You   can   define   the   symbols   using   the   #define   statement   in   each   source   file,   or   by   specifying   the   /D_WIN32_WINNT=0x0500   compiler   option   supported   by   Visual   C++.  
   
  Visual   C++   6.0:     To   specify   compiler   options,   go   to   the   Projects   menu   and   click   Settings,   then   select   the   C/C++   tab.  
   
  Visual   C++   7.0:     To   specify   compiler   options,   go   to   the   Projects   menu   and   click   Properties.  
   
  The   macros   in   Win32.mak   can   help   you   define   the   correct   macros.   The   value   of   _WIN32_WINNT   depends   on   the   platform   you   choose   to   target.   For   more   information,   see   Building   Applications   Using   Win32.mak.

关于_WIN32_WINNT相关推荐

  1. VS中遇到 _WIN32_WINNT not defined

    VS2010中自己编程时遇到这个问题 _WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h) 解决办 ...

  2. 关于NTDDI_VERSION,_WIN32_WINNT,WINVER的含义

    在使用一些新版本的API,或者控件的新特性(比如新版的ComCtl32.dll)的时候,你可能会得到"error C2065: undeclared identifier."这个错 ...

  3. VS2010编译错误:fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x

    编译VTK,MFC时,mfc对版本的要求问题: 解决方法原文链接:http://www.cnblogs.com/madhenry/archive/2011/06/29/2093678.html 最近拿 ...

  4. 关于_WIN32_WINNT的含义

    在使用一些新版本的API,或者控件的新特性(比如新版的ComCtl32.dll)的时候,你可能会得到"error C2065: undeclared identifier."这个错 ...

  5. WINVER 和 _WIN32_WINNT

    WINVER 和 _WIN32_WINNT 请在WINDOWS.H前定义 从 Visual C++ 2008 开始,Visual C++ 不支持面向 Windows 95.Windows 98.Win ...

  6. 修改WINVER、_WIN32_WINNT和_MSC_VER

    1.WINVER和_WIN32_WINNT         Visual C++已经不再支持Windows 95, Windows 98, Windows ME, Windows NT or Wind ...

  7. _WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h

    警告报告: _WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h) 处理办法: 第一步: " ...

  8. 关于关于_WIN32_WINNT的说明

    在使用一些新版本的API,或者控件的新特性(比如新版的ComCtl32.dll)的时候,你可能会得到"error C2065: undeclared identifier."这个错 ...

  9. _WIN32_WINNT not defined

     警告报告: _WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h 处理办法: 在StdAfx.h头 ...

最新文章

  1. SAP MM 采购发票上的价格与采购订单上价格的差异
  2. js判断是否为数字_第23题:JavaScript 中如何判断变量是否为数字 ?
  3. Android-Universal-Image-Loader 的使用说明
  4. Java这些多线程基础知识你会吗?
  5. python在函数外调用变量
  6. sqlserver——视图
  7. 对称加密之分组加密【四】
  8. java 抛出空指针_java - Java ServerSocket抛出空指针异常 - 堆栈内存溢出
  9. 控制台总是输出:xcode error: failed to attach to process ID 0
  10. linux里车目录是什么意思,linux 命令整理
  11. Julia : 又一次 ”协变“ 中招!
  12. 蓝牙耳机连接电脑,提示无法安装驱动程序
  13. 网络规划设计师水平考试备考资料(11.分析总结)
  14. 中科大计算机招非全日制,中国科学技术大学工商管理(非全日制)招生简章
  15. 移动电影院迎来2.0版本,5部影片在移动电影院上举办“首映礼”
  16. echarts实现自定义扩展地图-中国七大区域图
  17. 博图v16组态wincc_体验博途V16的新玩意WinCC Unified(二)Hello World篇
  18. 裁员10%,涉万人!Tesla这次“玩”大了…
  19. 写给前端工程师的色彩常识:色彩三属性及其在CSS中的应用
  20. z80 cpu 机电系统计算机控制,拆解PreComputer 1000计算机:基于可靠的Zilog Z80处理器电路设计方案...

热门文章

  1. 网易有数永久免费开放BI能力 普惠让技术更有温度
  2. 单片机位寻址举例_基于80C51单片机位寻址编程
  3. ubuntu repo安装方法
  4. 创龙基于AM5728平台的PCIe通信案例(一)
  5. 好消息!!!XMind出视频教程了
  6. 怎么提高图片分辨率?如何改变图片的分辨率?
  7. 世界上最著名的24句哲理
  8. dabo(达泊西汀)
  9. Powershell无法执行脚本问题解决方案
  10. 求线段或直线与圆的交点