Anantha Subramaniam
Anantha Subramaniam

Reputation: 196

Build Issues after Upgrading app from vs2005 to vs2012

I need my application to be upgraded from visual studio 2005 IDE to visual studio 2012 . The upgradation wizard converts the solution and project files successfully with 0 errors and few warnings.

But when i start building the application i get error message :

error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher is recommended. in atlcore.h !

I tried changing the version no to 0x0500 , 0x0501 , 0x0502 and also 0x0601 ( both through /D compiler option and manually changing in atlcore.h , WINVER is also changed. ) but no luck . the same error is being displayed.

Where do i go wrong ?

Upvotes: 1

Views: 8635

Answers (3)

Maiakaat
Maiakaat

Reputation: 91

you can add a pre-processor directive for the project under project settings, C/C++, Pre-processor definitions, appending WINVER=0x0501;

(you can also undefine definitions)

I'm wondering if you are using pre-compiled headers which is overwriting changes to stdafx.h, this is the way to make sure this is set

This preprocessor setting holds until code in the project files changes it, at which point if this doesn't fix the problem, then you must find how or where this is being set/unset/checked; but the solutions shouldn't involve any changes to the windows SDK files

Upvotes: 0

Anantha Subramaniam
Anantha Subramaniam

Reputation: 196

Problem temporarily solved by commenting a check in atlcore.h :

if _WIN32_WINNT > 0x0501

//#error This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher is recommended.

endif

I know it isnt the right way to do [ editing a file shipped by the IDE ] but did since it may be due to Improper installation.

If anyone come across a permanent fix let me know .

Upvotes: 0

jiten
jiten

Reputation: 5264

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.

To modify the macros, in a header file, add the following lines.

#define WINVER 0x0500
#define _WIN32_WINNT 0x0500

EDIT:

WINVER determines the minimum platform SDK required to build your application, which in turn will determine at compile time which routines are found by the headers.

#define _WIN32_WINNT_NT4     0x0400
#define _WIN32_WINNT_WIN2K     0x0500
#define _WIN32_WINNT_WINXP     0x0501
#define _WIN32_WINNT_WS03     0x0502
#define _WIN32_WINNT_WIN6     0x0600
#define _WIN32_WINNT_VISTA     0x0600
#define _WIN32_WINNT_WS08     0x0600
#define _WIN32_WINNT_LONGHORN    0x0600
#define _WIN32_WINNT_WIN7     0x0601

Other Solution:

If you have installed a WIndows SDK on your PC (in /Microsoft SDKs/Windows), you can #include in stdafx.h (or in a header you include in all your C++ files). Including SDKDDKVer.h will target the highest Windows version available.

Hopefully It work!!!!!

For more info SEE HERE

Upvotes: 4

Related Questions