Visual C/C++ 6.0 为何不支持新的SDK

 首先请原谅我还在谈论这么一个老的开发环境和它上面的问题。但是我现在正在学习和使用它,市面上有不少的书籍在介绍它,大部分学校的老师在讲解它(可惜我们学校不是,要不我就不会自学得这么辛苦了,总是被网上泛滥的资料弄得头晕脑涨)。

由于前几天写的一个小程序用到了新的API函数,所以要升级SDK,可是微软站点的介绍中确有这个一段话:

This SDK does not support working with Microsoft Visual C / C ++ 6.0   as  support  for  VC  6.0  has ended. The last SDK that will work with VC  6.0   is  the February  2003  Edition, you can order a CD on the fulfillment site.

6.0不被支持,这是怎么回事?查看了Platform SDK Documentation才知道,原来如此:

Installing the Platform SDK with Visual Studio (From the Platform SDK Documentation for Windows Server 2003 SP1)

Microsoft 的 Visual C/C++ 包含一份 Visual C++ 发布时的 Microsoft Platform SDK 的内容的快照。随着时间的流逝,Visual C++ 包含的 Platform SDK 的内容将会过时,因为Platform SDK的更新时间表于Visual C++的不同。这些内容包括SDK工具,windows的头文件以及库文件。

警告:你不能将当前版本Platform SDK的库文件用于Visual C/C++ 6.0,因为这些库在编译时使用了新的/GS开关来开启检测缓冲区溢出的代码。如果将这些使用了这个开关编译的库文件用于Visual C/C++ 6.0 会导致链接错误。明确地说,链接器会报告说它找不到__security_cookie 或 __security_check_cookie。

To install the Platform SDK for use with Visual C++

1、运行SDK的安装程序,安装SDK到它自己的目录里面。

2、确保SDK的bin目录列在Visual C++的bin目录前面。为了在命令行组建,使用设置命令检查PATH环境变量。为了在Visual Studio中组建,你必须更新目录选项。
 a、点击Tools菜单下的Options选项。
 b、在左侧窗体中点击Projects,然后是VC++ Directories。
 c、在Show directories for中选择Executable files,然后使用上下箭头来改变路径的顺序。

3、确保SDK的include目录列在Visual C++的include目录前面。为了在命令行组建,使用设置命令检查INCLUDE环境变量。为了在Visual Studio中组建,你必须更新目录选项。
 a、点击Tools菜单下的Options选项。
 b、在左侧窗体中点击Projects,然后是VC++ Directories。
 c、在Show directories for中选择Include files,然后使用上下箭头来改变路径的顺序。

4、确保SDK的lib目录列在Visual C++的lib目录前面。为了在命令行组建,使用设置命令检查LIB环境变量。为了在Visual Studio中组建,你必须更新目录选项。
 a、点击Tools菜单下的Options选项。
 b、在左侧窗体中点击Projects,然后是VC++ Directories。
 c、在Show directories for中选择Library files,然后使用上下箭头来改变路径的顺序。

5、在构建你的应用程序时定义适当的宏。为了获取更多信息,参照Using the Windows Headers。

 


 

Using the Windows Headers

The header files for the Windows API enable you to create 32- and 64-bit applications. They 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 Visual C++ includes copies of the Windows header files that were current at the time Visual C++ was released. Therefore, if you install updated header files from an SDK, you may end up with multiple versions of the Windows header files on your computer. If you do not ensure that you are using the latest version of the SDK header files, you will receive the following error code 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 common macros you must define to target each major operating system release. (Individual header files may use different macros; therefore, if compilation problems occur, check the header file that contains the definition for conditional definitions.)

Minimum system required   Macros to define

Windows Server 2003   _WIN32_WINNT>=0x0502 WINVER>=0x0502

Windows XP    _WIN32_WINNT>=0x0501 WINVER>=0x0501

Windows 2000    _WIN32_WINNT>=0x0500 WINVER>=0x0500

......

详情见Platform SDK documentation

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值