您的位置:首页 > 编程语言 > C语言/C++

windwos 7和vs2010 c++ 下编译工程,出现错误fatal error C1189

2011-10-12 14:22 387 查看




mx17

等 级:


也遇到这个问题了,

添加:#define _WIN32_WINNT 0x0501

可以解决那个报错,但是又出来另外的报错了,不过楼上各位的方法给了我一个思路

下面是彻底解决方法:

在工程的stdafx.h中添加(如有类似语句,需注释掉)

#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.

#define WINVER 0x0501 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.

#endif

#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.

#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.

#endif

#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.

#define _WIN32_WINDOWS 0x0501 // Change this to the appropriate value to target Windows Me or later.

#endif

#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.

#define _WIN32_IE 0x0601 // Change this to the appropriate value to target IE 5.0 or later.

#endif

#15楼 得分:0回




applemacosx

(applemacosx)

等 级:


#23楼 得分:0回复于:2011-08-29 22:58:26
我也遇到过这个问题,差点折腾死我。我的环境是VS2010+Windows Server 2008 r2.上面的问题不能完美的解决。我来说一下我摸出来的一个规则。之前我也参照他们的这些说法瞎折腾,但是还是报错,然后我新建了一个VC的项目,然后对比了一下突然发现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。再编译,所有问题都解决了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐