Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile Errors upgrading ATL project from vs2010 to vs2013 [duplicate]

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

This does not occur when building using VS2010.

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

like image 825
CCondron Avatar asked May 13 '14 20:05

CCondron


1 Answers

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

from 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.

So, changing

#ifndef WINVER  
#define WINVER 0x0400   
#endif

to

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

corrects the build problem

like image 69
CCondron Avatar answered Oct 15 '22 14:10

CCondron