编译器错误at atlwin.h [英] Compiler Errors in atlwin.h

查看:1039
本文介绍了编译器错误at atlwin.h的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当在Visual Studio 2013中包含来自Microsoft ATL库的atlwin.h时,会导致关于未定义元素的大量编译错误。

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

ie

#include <atlwin.h>
class MainWnd : public CWindowImpl<MainWnd>
{};




CWindowImpl:未定义基类错误。 >

"CWindowImpl: base class is not defined" error.


HMONITOR未定义

HMONITOR is not defined

使用VS2010构建时不会发生。

This does not occur when building using VS2010.

如何解决?

推荐答案

问题是在stdafx.h文件中的目标版本的windows

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 ++的早期版本的
创建的项目时,如果将它们分配到Windows的版本
,您可能会看到与WINVER或_WIN32_WINNT宏有关的编译错误

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.

So, changing

#ifndef WINVER
#define WINVER 0x0400
#endif

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

更正构建问题

这篇关于编译器错误at atlwin.h的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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