winnt.h errors?

I have just linked Direct X 9 to the new of Microsoft Visual Studio 2005 Beta 2. Trying to compile a program i know that works under Microsoft Visual C++ 6.0 gives me the following errors:

c:\program files\microsoft visual studio 8\vc\platformsdk\include\winnt.h(222) : error C2146: syntax error : missing ';' before identifier 'PVOID64'

c:\program files\microsoft visual studio 8\vc\platformsdk\include\winnt.h(222) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

c:\program files\microsoft visual studio 8\vc\platformsdk\include\winnt.h(5932) : error C2146: syntax error : missing ';' before identifier 'Buffer'

c:\program files\microsoft visual studio 8\vc\platformsdk\include\winnt.h(5932) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

c:\program files\microsoft visual studio 8\vc\platformsdk\include\winnt.h(5932) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

Could someone tell me what i have done wrong and why the new compiler doesn't want to understand simple declerations

[1204 byte] By [Cookman] at [2008-2-26]
# 1
Can you please offer some more information? It's highly unlikely that the new VC++ compiler doesn't understand simple declarations (I use it all the time).

Please post a small sample of code and a description of what you're trying to do.

DavidWeller at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 2
This usually means that on of the #includes before winnt.h (or the one that included it, etc...) has an error in it. One of the most common (and which almost always causes a "missing ;" error) is not having a semicolon after a struct, e.g. you have a header file with:
struct blah
{
int whatever;
} < missing semicolon!
TomForsyth at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 3

The only includes i have is including direct X 9:

#include <d3dx9.h>

So either it is included in the direct X library (most likely) and something befor it is missing a semi-colon or it is being included by the compiler and may not be entirely nessesary to the project anyway (less likely I think).

Befor the errors you get the following declerations: So it may be a problme with a colon missing in basetsd.h

#include <basetsd.h>

#if (defined(_M_IX86) || defined(_M_IA64) || defined(_M_AMD64)) && !defined(MIDL_PASS)

#define DECLSPEC_IMPORT __declspec(dllimport)

#else

#define DECLSPEC_IMPORT

#endif

#ifndef DECLSPEC_NORETURN

#if (_MSC_VER >= 1200) && !defined(MIDL_PASS)

#define DECLSPEC_NORETURN __declspec(noreturn)

#else

#define DECLSPEC_NORETURN

#endif

#endif

#ifndef DECLSPEC_ALIGN

#if (_MSC_VER >= 1300) && !defined(MIDL_PASS)

#define DECLSPEC_ALIGN(x) __declspec(align(x))

#else

#define DECLSPEC_ALIGN(x)

#endif

#endif

#ifndef SYSTEM_CACHE_ALIGNMENT_SIZE

#if defined(_AMD64_) || defined(_X86_)

#define SYSTEM_CACHE_ALIGNMENT_SIZE 64

#else

#define SYSTEM_CACHE_ALIGNMENT_SIZE 128

#endif

#endif

#ifndef DECLSPEC_CACHEALIGN

#define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(SYSTEM_CACHE_ALIGNMENT_SIZE)

#endif

#ifndef DECLSPEC_UUID

#if (_MSC_VER >= 1100) && defined (__cplusplus)

#define DECLSPEC_UUID(x) __declspec(uuid(x))

#else

#define DECLSPEC_UUID(x)

#endif

#endif

#ifndef DECLSPEC_NOVTABLE

#if (_MSC_VER >= 1100) && defined(__cplusplus)

#define DECLSPEC_NOVTABLE __declspec(novtable)

#else

#define DECLSPEC_NOVTABLE

#endif

#endif

#ifndef DECLSPEC_SELECTANY

#if (_MSC_VER >= 1100)

#define DECLSPEC_SELECTANY __declspec(selectany)

#else

#define DECLSPEC_SELECTANY

#endif

#endif

#ifndef NOP_FUNCTION

#if (_MSC_VER >= 1210)

#define NOP_FUNCTION __noop

#else

#define NOP_FUNCTION (void)0

#endif

#endif

#ifndef DECLSPEC_ADDRSAFE

#if (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))

#define DECLSPEC_ADDRSAFE __declspec(address_safe)

#else

#define DECLSPEC_ADDRSAFE

#endif

#endif

#ifndef DECLSPEC_NOINLINE

#if (_MSC_VER >= 1300)

#define DECLSPEC_NOINLINE __declspec(noinline)

#else

#define DECLSPEC_NOINLINE

#endif

#endif

#ifndef FORCEINLINE

#if (_MSC_VER >= 1200)

#define FORCEINLINE __forceinline

#else

#define FORCEINLINE __inline

#endif

#endif

#ifndef DECLSPEC_DEPRECATED

#if (_MSC_VER >= 1300) && !defined(MIDL_PASS)

#define DECLSPEC_DEPRECATED __declspec(deprecated)

#define DEPRECATE_SUPPORTED

#else

#define DECLSPEC_DEPRECATED

#undef DEPRECATE_SUPPORTED

#endif

#endif

#ifdef DEPRECATE_DDK_FUNCTIONS

#ifdef _NTDDK_

#define DECLSPEC_DEPRECATED_DDK DECLSPEC_DEPRECATED

#ifdef DEPRECATE_SUPPORTED

#define PRAGMA_DEPRECATED_DDK 1

#endif

#else

#define DECLSPEC_DEPRECATED_DDK

#define PRAGMA_DEPRECATED_DDK 1

#endif

#else

#define DECLSPEC_DEPRECATED_DDK

#define PRAGMA_DEPRECATED_DDK 0

#endif

//

// Void

//

typedef void *PVOID;

typedef void * POINTER_64 PVOID64;


The errors accure on the bottom two lines

Cookman at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 4
I point the finger at the Platform SDK - most probably your particular configuration (or lack thereof) Smile

I've seen these sorts of errors on various forums now, and it usually seems to be with people not having a suitable version of the PSDK - upgrading it as appropriate (or, in the case of VC++6 downgrading the DX-SDK) from here is my suggestion.

It does seem odd that the latest VStudio is causing you problems, and I could be wrong - but that download should analyse your current setup and determine if/what needs upgrading, so it *shouldn't* do you any harm..

I never dug into it in too much detail, but I did see a post that suggested the various errors are due to a number of typedef and/or #define statements being eliminated and thus leaving "gaps" that confuse the compiler.

hth
Jack

JHoxley at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 5
Not that it's particularly important... but that above post was from me. I'm finding that MSN messenger is playing havoc with the forums so I somehow managed to create a new account to post under. Go figure!
JackHoxley at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 6
Change POINTER_64 to __ptr64. That should do the trick.Big Smile
AaronKravitz at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 7
I just finished porting a large (HUGE!) code base over to VC2005 and ran into that error. In this case there was an older version of basetsd.h somewhere in the path that was being picked up before 2005's.
KenPaulson at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 8
I was getting those same errors with a project that had an empty main file and only included the windows.h file.
The errors started with the following line in winnt.h:
winnt.h(222) typedef void * POINTER_64 PVOID64;
So I changed the line to:
winnt.h(222) typedef void * POINTER_64,* PVOID64;
then everything compiled and ran.
But why should this work? Is there somthing about typedef that I am not understanding?
rlterrel at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 9

rlterrel wrote:
So I changed the line to:
winnt.h(222) typedef void * POINTER_64,* PVOID64;
then everything compiled and ran.

But why should this work? Is there somthing about typedef that I am not understanding?

Yes, POINTER_64 is supposed to be be defined as a macro that expands to __ptr64 which a magic keyword that newer Microsoft compilers understand. It changes the size of the pointer to 64-bits even when compiling 32-bit code. It's not safe to make the change you made because it defines PVOID64 as a 32-bit pointer instead of a 64-bit pointer as intended. This error message either indicates that you're using and old compiler or that there's something wrong with your include files. Try moving the Windows SDK include directory to the start of your include search path, you might be picking up incompatible headers from different directories.

RossRidge at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 10

Ken Paulson wrote:
I just finished porting a large (HUGE!) code base over to VC2005 and ran into that error. In this case there was an older version of basetsd.h somewhere in the path that was being picked up before 2005's.

This seems to have been my problem as well. I opened the offending winnt.h and changed the include for "basetsd.h" to explicitly point to "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Include\BaseTsd.h", and that particular error went away. Now to figure out what's goofing up my include search path so I can fix it the right way... Thanks for the info!!

Matt_FL at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 11
The problem is that the dx9 sdk includes its own version of basetsd.h for whatever reason.
tjcbs at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...
# 12
tjcbs wrote:
The problem is that the dx9 sdk includes its own version of basetsd.h for whatever reason.

You'r 100% right, older versions of DX9 sdk (DX9b sdk) has it's own BaseTsd.h file, go into your visual studio folder, and extract basetsd.h and overwrite the one in dx9sdk, compiles perfectly, thanks

Regards bear

bear_2150 at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...