将ATL项目从vs2010升级到vs2013的编译错误 [英] Compile Errors upgrading ATL project from vs2010 to vs2013

查看:126
本文介绍了将ATL项目从vs2010升级到vs2013的编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio 2013构建中包括Microsoft ATL库中的atlwin.h时,可能会导致有关未定义元素的许多编译器错误.

When including atlwin.h from the Microsoft ATL libraries in Visual Studio 2013 building may result in numerous complier errors about undefined elements.

HMONITOR is not defined

使用VS2010构建时不会发生这种情况.

This does not occur when building using VS2010.

由于这是标准的MS头文件,因此缺少类错误似乎没有道理.

As this is a standard MS header file the missing class errors do not seems to make sense.

推荐答案

由于这是一个非常古老的遗留项目,因此问题在于stdafx.h文件中Windows的目标版本

As this is a very old legacy project the problem is with the targeted version of windows in the stdafx.h file

来自MSDN

Visual C ++不再支持Windows 95,Windows 98, Windows ME或Windows NT.如果您的WINVER或_WIN32_WINNT宏是 分配给这些版本的Windows之一,您必须修改 宏.当您升级通过使用 Visual C ++的早期版本,您可能会看到与编译错误有关的信息 分配给WINVER或_WIN32_WINNT宏(如果已将它们分配给一个版本) 不再支持的Windows版本.

Visual C++ no longer supports targeting Windows 95, Windows 98, Windows ME, or Windows NT. If your WINVER or _WIN32_WINNT macros are assigned to one of these versions of Windows, you must modify the macros. When you upgrade a project that was created by using an earlier version of Visual C++, you may see compilation errors related to the WINVER or _WIN32_WINNT macros if they are assigned to a version of Windows that is no longer supported.

所以,改变

#ifndef WINVER  
#define WINVER 0x0400   
#endif

#ifndef WINVER  
#define WINVER 0x0500
#define _WIN32_WINNT 0x0500
#endif

更正了构建问题

这篇关于将ATL项目从vs2010升级到vs2013的编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆