gpt4 book ai didi

c++ - atlwin.h 中的编译器错误

转载 作者:塔克拉玛干 更新时间:2023-11-03 08:18:59 24 4
gpt4 key购买 nike

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

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

"CWindowImpl: base class is not defined" error.

HMONITOR is not defined

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

我该如何解决?

最佳答案

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

来自 MSDN

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

更正构建问题

关于c++ - atlwin.h 中的编译器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20314124/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com