Thanks for reading. 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.

thanks

Which version of vc++ 2010 did you install? Express does not support atl or mfc.

Thanks for the reply. Ultimate.

I suppose you have already figured out that the error message is coming from line 26 of the code you posted. Find out how _WIN32_WINNT is defined and then define it correctly yourself. (Right-click on the symbol and you will have the option to go to where its defined) Something has probably changed between verion 2005 and 2010. I don't have the ultimate edition, so I can't really help you.

Ok thanks I'll give that a try.

Fixed...

Thanks for the help.

Context.h looked like 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 _WIN32_WINNT line as follows

#pragma once


#include <windows.h>
#include <winwlx.h>
#include <ObjBase.h>
#include <comdef.h>
#include <atlbase.h>

extern CComModule _Module;

#include <atlcom.h>
#include <vector>

#define _WIN32_WINNT 0x0400

and it worked fine. Odd, but it works.

thanks again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.