VS打开老版本的解决方案报错情况

来源:互联网 发布:ubuntu做什么 编辑:程序博客网 时间:2024/05/01 17:13
我的环境是VS2010+Windows Server 2008 r2.上面的问题不能完美的解决。我来说一下我摸出来的一个规则。之前我也参照他们的这些说法瞎折腾,但是还是报错,然后我新建了一个VS的项目,然后对比了一下突然发现VS会自动生成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>
以后大家遇到这个问题就新建一个h文件,把上面的代码复制进去,然后在工程的stdafx.h的顶部添加 include"targetver.h",记得删除所有类似下面的代码:
#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。再编译,所有问题都解决了。
0 0