Click here to Skip to main content
15,891,745 members
Please Sign up or sign in to vote.
1.44/5 (3 votes)
See more:
i am converting a vs 2008 project to vs2017.
plz help me how to solve this error.

What I have tried:

i tried of changing winver 0x0400 and _win32_winnt 0x0400 to 0x601.
Posted
Updated 12-Aug-17 5:24am
Comments
Jochen Arndt 31-Jul-17 5:03am    
Where did you defined them?

They must be defined before including any Windows header file. That is on top of stdafx.h with precompiled headers. Otherwise on top of each file that includes Windows header files or as global compiler option in the project settings.

If the error is then still there, there might be a re-definition in some of your files.

However, you should have seen the error with VS 2008 too with missing or wrong definitions.

How are you converting the project?
Did you use the VS 2008 project folder or a full copy?
If yes, delete all output and intermediate files or do a full rebuild.
Naveen_vemuri 31-Jul-17 7:58am    
i am building project using MsBuild.I opened vs2008 project in vs2017 and it made the necessary changes to convert it to vcxproj.I am not aware of what was written in source files.I am rewriting batch file and setting required environment to build it without visual studio.There are nearly 20-30 cpp files and so many headerfiles in that project.there is one stdafx.h file but in that there is no windows.h file included.i made changes in the file above i mentioned(atlwinverapi.h) like i find the declaration of "LCMapStringEx" in WinNls.h file i just copied and pasted in this file and the error is resolved.but after i got another error afxwin.h file not found and i gave paths to the atl library.then this identifier not found error is again coming.i am not getting exact clarity of what to do to resolve this error.
Jochen Arndt 31-Jul-17 8:15am    
If there is an stdafx.h file it is probably used.
The windows.h header file is included by other files from that header file.
When adding the definitions, they must be on top of the stdafx.h file.

As already mentioned below by Richard, default values are selected by VS when the definitions are not present. Then there should be no problems when updating to a newer VS version and newer SDK versions.

"I am rewriting batch file and setting required environment to build it without visual studio."

Try first to rebuild from within the VS 2017 IDE. That will overwrite old output files and ensures usage of the selected SDKs.

Once that is creating the target without errors, you can try to use your batch file and MSBuild.
Naveen_vemuri 1-Aug-17 1:17am    
i added definitions on top of stdafx.h file.but the error is not resolved.what is the meaning of this error?why the error is coming in a headerfile provided by microsoft atl library file?
Jochen Arndt 1-Aug-17 3:05am    
The function is defined in winnls.h which is included by windows.h.

The definition is guarded for the minimum target windows version (Vista).
This guard uses one of your definitions or NTDDI_VERSION (which is created from the other definition within sdkddkver.h).

So you have to check which definition is active when winnls.h is included. You might also follow the include file tree by enabling extended compiler output to show each file processed. Than you can step back from the error to check all non-MS files if there is a strange setting somewhere.

But only you can do that because it requires to have the full project. I have no VS 2017 installed here at work (only at home) so that I even can't check the VS 2017 SDK files.

1 solution

1. Search for definitions of _WIN32_WINNT in the current project files, if there are some of them, erase them.

2. Add StdAfx (header and source) files in the project.

3. In StdAfx.h define the following macros:

#define _WIN32_WINNT 0x0A00
#define _ATL_APARTMENT_THREADED
#define _USING_V110_SDK71_
#define _ATL_XP_TARGETING

4. Include StdAfx.h header to the source files that needs these macros. StdAfx.cpp is required to always include its header.
5. Insert the respective macros; go to the Project Properties, Configuration Properties, C/C++, Preprocessor, edit Preprocessor Definitions, and insert these macros with the next syntax:

NTDDI_VERSION= 0x06030000
WINVER=0x0A00
_WIN32_WINNT=0x0A00



6. Additionally, In StdAfx.h include the following “Afx” headers after the Macros definitions:


#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers

#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions

#ifndef _AFX_NO_OLE_SUPPORT
#include <afxole.h> // MFC OLE classes
#include <afxodlgs.h> // MFC OLE dialog classes
#include <afxdisp.h> // MFC Automation classes
#endif // _AFX_NO_OLE_SUPPORT

#ifndef _AFX_NO_DB_SUPPORT
#include <afxdb.h> // MFC ODBC database classes
#endif // _AFX_NO_DB_SUPPORT

#ifndef _AFX_NO_DAO_SUPPORT
#include <afxdao.h> // MFC DAO database classes
#endif // _AFX_NO_DAO_SUPPORT

#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT

#include <windows.h>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900