今天一个老的VC项目,在Win8和VS2008上编译,之前是debug版编不过,网上查了会问题,然后再看到代码文件stdafx.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
将 #define _WIN32_WINNT 0x0400
改为 #define _WIN32_WINNT 0x0500
后debug版通过编译,但是release版还是编译不过,报错:
error C2039: 'NotifyWinEvent' : is not a member of '`global namespace''
error C2660: 'CWnd::NotifyWinEvent' : function does not take 4 arguments
然后将 #define WINVER 0x0400
改为 #define WINVER 0x0500
release版也编译通过!
#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
将 #define _WIN32_WINNT 0x0400
改为 #define _WIN32_WINNT 0x0500
后debug版通过编译,但是release版还是编译不过,报错:
error C2039: 'NotifyWinEvent' : is not a member of '`global namespace''
error C2660: 'CWnd::NotifyWinEvent' : function does not take 4 arguments
然后将 #define WINVER 0x0400
改为 #define WINVER 0x0500
release版也编译通过!
本文介绍了一个老的VC项目在Win8和VS2008环境下进行编译时遇到的问题及其解决方案。通过调整预编译头文件中的宏定义,解决了debug和release版本的编译错误。

3432

被折叠的 条评论
为什么被折叠?



