Click here to Skip to main content
15,898,869 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi,
I have a C++ application using Win32 API and it has always compiled fine from Visual Studio 2003 to 2008 under XP 32Bit.
Now I have Windows 7 64 Bit and it also compiled fine with VS2008. I have recently migrated it to VS2010 and now I cannot get it to compile anymore. It is not a linker problem, I get these messages when compiling (example):

Error 211 error C2061: Syntax error: identifier 'LPSCROLLINFO'    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\commctrl.h  8608    1 TMB


A load of other syntax errors follow, all stating that one or another identifier is not defined. Funny thing is that when I use "Go to definition" on one of these "undefined" identifiers the editor promptly shows me the definition in "winuser.h" for example. I am going crazy since I seem to be the only person having this problem according to google.

I have Win SDK 7.1 installed and have just run repair installation. commctrl.h is included after windows.h.

Please help me :)
Posted
Updated 17-Feb-11 1:52am
v2
Comments
Espen Harlinn 17-Feb-11 7:09am    
Getting rid of the german version of VS might help you when it comes to searching google for similar errors - for developers it usually makes sense to use an english only development environment: english windows 7, english office 2010, english visual studio 2010 - you can always install a german language pack to get german spell checking, and other really required localized features.
mheye 17-Feb-11 7:25am    
I have been searching in english for all sorts of possible combinations, but I get either questions/answers that end in "include commctrl.h after windows.h" or linker specific problems.

Something i like to do is develop and maintain my own target header that should be the first #include in the precompiled header (remember to target the MINIMUM OS supported)... this should save you problems that come up if using methods not supported in an older target OS (than the one you're developing in) or problems where the version was auto-magically selected. For possible values, look up the constants on MSDN.

Example Header:
#ifndef MYAPP_TARGET_H
#define MYAPP_TARGET_H

#ifndef WINVER
#define WINVER 0x0600
#endif

#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0600
#endif

#ifndef _WIN32_WINDOWS
#define _WIN32_WINDOWS 0x0410
#endif

#endif //MYAPP_TARGET_H
 
Share this answer
 
v2
Comments
Espen Harlinn 17-Mar-11 10:47am    
Worth thinking about - my 5
Albert Holguin 17-Mar-11 10:51am    
lol... thanks espen...
It would also help if you translated your message for us, to Syntax Error: Identifier. This usually indicates that some token before this keyword has not been interpreted correctly. Check your windows version settings in your main header file (StdAfx.h or similar) to ensure that you are getting the correct definitions for your build.
 
Share this answer
 
Comments
mheye 17-Feb-11 7:51am    
I have not set any windows version in any of my headers, I do have the target platform set (Win32). Changed message to english.
mheye 17-Feb-11 8:00am    
I feel like a complete fool now :) After adding this: "#define WINVER 0x06010000" before windows.h it compiles. Why has that never been necessary before? Anyway it seems to be fine now, thanks for pointing toward the windows version.
Emilio Garavaglia 17-Feb-11 9:12am    
That depends on the way the headers were written.
into <windows.h> (may be <winddef.h> ... ) there is a declaration like
#ifndef WINVER
#define WINVER 0x??????
#endif

where "????" is a "reasonably suitable number that can be used with the product in the most of the cases" (The concept of "reasonably" depends on the developers of the header that in turn reflect the opinions of their marketing).

Now, if your header had been written to default to 32 bit, and some other environmental constants (the one that has two _ before and after) suggests 64 bit, may be some declaration miss, or are different.

by specifying yourself a WINVER, you made it coherent.
Richard MacCutchan 17-Feb-11 10:39am    
VS2010 uses a new set of #defines to set the windows version. I'm not sure of the details of how it does it but it is supposed to detect your OS level and SDK automatically. If you create a simple Windows app in VS you can look at the StdAfx.h file to see how it does it, and trace back to what value is being set. Don't you just love Microsoft?
mheye 17-Feb-11 8:09am    
also this site is fooling me all the time into believing my post is not up :P

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



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