开发者

After installing VS2008, I get a compile error in winnt.h

开发者 https://www.devze.com 2022-12-19 01:19 出处:网络
I\'m trying to move our project over to VS2008 from VS2005 and am running in to this build error on an MFC project:

I'm trying to move our project over to VS2008 from VS2005 and am running in to this build error on an MFC project:

C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winnt.h(236) : error C2146: syntax error : missing ';' before identifier 'PVOID64'

I thought this was an SDK issue or an include directory ordering issue as some forums have suggested but that doesn't seem to be the problem. Has anyone seen this before? What should I be looking for when trying to track this down?

I'm also wondering if I need to increase the WINVER preprocessor flags in my project's stdafx. They are pretty old:

#ifndef WINVER              
#define WINVER 0x0500       
#endif

#ifndef _WIN32开发者_运维技巧_WINNT        
#define _WIN32_WINNT 0x0500
#endif                      

#ifndef _WIN32_WINDOWS  
#define _WIN32_WINDOWS 0x0510 
#endif

#ifndef _WIN32_IE           
#define _WIN32_IE 0x0500    
#endif

Thanks


This only happens in projects that include DirectShow include files. The problem is that there is a Basetsd.h that is part of the DirectShow SDK that is being included prior to the inclusion of the Windows SDK's Basetsd.h. The DirectShow version doesn't define POINTER_64 (because it's old) and then causes the problem I reported.

The solution is to add the include directory to the SDK in the offending project's addition includes setting. As in:

"$(WindowsSdkDir)\include"

This started happening after I upgraded to VS2008 from VS2005 because previously, the SDK include directive was given as:

"$(VCInstallDir)PlatformSDK\include"

Which is no longer the location of the platform SDK in VS2008


I had this exact problem after installing VS2012RC (instead of the question's VS2008) with VS2005. Karim's answer is mostly right about the problem, but his solution didn't work for me. Fortunately, someone else here at work had already fixed this issue.

The problem appears to be that the VS installer found the DirectX9 SDK and put it in its per-user directory "properties" file. So the fix that works for us is to edit the user's directory properties file (with a text editor), remove all references to "dx90sdk" directories, and then reload Visual Studio.

The file in question appears to get stored at:

%USERPROFILE%\appdata\local\microsoft\msbuild\v4.0\Microsoft.Cpp.Win32.user.props

This fix may very well apply to Karim's situaton too, allowing him to avoid using the extra #include preprocessor statements.


You should try removing those WINVER macros from your stdafx.h. Those versions (5.0 and 5.1) predate Win64, so they probably don't have the declaration for PVOID64.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号