I installed VS2010 after a drive crash, prior I had VS2005 and everything was fine.
Now on compiling a C++ app that was fine previously I am seeing a couple of errors which I just cannot figure out.
Error 1 error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher is recommended. C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include\atlcore.h 35 1 BIOXGINA
#ifndef __ATLCORE_H__
#define __ATLCORE_H__
#pragma once
#ifdef _ATL_ALL_WARNINGS
#pragma warning( push )
#endif
#pragma warning(disable: 4786) // identifier was truncated in the debug information
#pragma warning(disable: 4127) // constant expression
#include <atldef.h>
#include <windows.h>
#include <ole2.h>
#include <limits.h>
#include <tchar.h>
#include <mbstring.h>
#include <atlchecked.h>
#include <atlsimpcoll.h>
34. #if _WIN32_WINNT < 0x0403
35. #error This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher is recommended.
36. #endif
#pragma pack(push,_ATL_PACKING)
namespace ATL
{
/////////////////////////////////////////////////////////////////////////////
// Verify that a null-terminated string points to valid memory
inline BOOL AtlIsValidString(
_In_z_count_(nMaxLength) LPCWSTR psz,
_In_ size_t nMaxLength = INT_MAX)
{
(nMaxLength);
return (psz != NULL);
}
If I comment out the above lines, I then get
error C3861 Identifier not found on line 111 below.
I presume I'm only getting this because I commented the above lines ?
HRESULT Init() throw()
{
HRESULT hRes = S_OK;
111. if (!InitializeCriticalSectionAndSpinCount(&m_sec, 0))
{
hRes = HRESULT_FROM_WIN32(GetLastError());
}
return hRes;
}
I would appreciate any assistance on this. Don't really want to reinstall 2005.
This Microsoft Connect issue has this potential solution:
edit file "stdafx.h" and change the value defined for _WIN32_WINNT and WINVER to 0x0502.
More discussion here about this error on the MSDN C++ forum: Problem with older VC Solution.
Your project targets a Windows version that is no longer supported by the newer compiler (or anything else).
You have to select a minimum target version that is Windows XP ("Windows 5") or later.
Thank you both for the replies.
I managed to get rid of the error message as follows. The Context.h looked liked this.
#pragma once
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include <winwlx.h>
#include <ObjBase.h>
#include <comdef.h>
#include <atlbase.h>
extern CComModule _Module;
#include <atlcom.h>
#include <vector>
I moved the #define _WIN32_WINNT 0x0400 to then end after all the includes, and it compiled Ok. Odd, but it worked.
I will however alter it to 0x0502 as suggested.
thanks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With