d3d9.h compile errors - VS Pro 2005

Started by
3 comments, last by Yozomiri 15 years, 8 months ago
Hello, A couple of days ago I wanted to start programming again, as it'd been a good year or so since I had done anything. I couldn't really remember my way around DirectX or the Win32 API, so I decided to start from scratch. I wrote up a really simple Win32 app, but the second I added d3d9.h (and d3dx9.h and d3dx9math.h) I started to get compiler errors from the headers. I read around a bit and tried things, but I havn't found a solution yet. I already set the include/lib directories and I put them on top, and I added d3d9.lib as a dependency (as well as some others). I'm using Visual Studio Pro 2005, if that's any help. The problem obviously originates with something going wrong in the includes, but I can't figure what it is. Here's the errors I'm getting:
Quote: e:\direct x sdk (nov 07)\include\d3d9.h(323) : error C2143: syntax error : missing ';' before '__stdcall' e:\direct x sdk (nov 07)\include\d3d9.h(323) : error C2433: 'IDirect3D9::HMONITOR' : 'virtual' not permitted on data declarations e:\direct x sdk (nov 07)\include\d3d9.h(323) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\direct x sdk (nov 07)\include\d3d9.h(323) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\direct x sdk (nov 07)\include\d3d9.h(323) : warning C4183: 'GetAdapterMonitor': missing return type; assumed to be a member function returning 'int' e:\direct x sdk (nov 07)\include\d3d9.h(323) : error C2253: 'IDirect3D9::GetAdapterMonitor' : pure specifier or abstract override specifier only allowed on virtual function e:\direct x sdk (nov 07)\include\d3d9.h(2016) : error C2143: syntax error : missing ';' before '__stdcall' e:\direct x sdk (nov 07)\include\d3d9.h(2016) : error C2433: 'IDirect3D9Ex::HMONITOR' : 'virtual' not permitted on data declarations e:\direct x sdk (nov 07)\include\d3d9.h(2016) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\direct x sdk (nov 07)\include\d3d9.h(2016) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\direct x sdk (nov 07)\include\d3d9.h(2016) : warning C4183: 'GetAdapterMonitor': missing return type; assumed to be a member function returning 'int' e:\direct x sdk (nov 07)\include\d3d9.h(2016) : error C2253: 'IDirect3D9Ex::GetAdapterMonitor' : pure specifier or abstract override specifier only allowed on virtual function e:\direct x sdk (nov 07)\include\d3d9.h(2229) : error C2061: syntax error : identifier 'UINT32' e:\direct x sdk (nov 07)\include\d3dx9math.inl(997) : error C2065: 'UINT_PTR' : undeclared identifier e:\direct x sdk (nov 07)\include\d3dx9math.inl(997) : error C2146: syntax error : missing ')' before identifier 'p' e:\direct x sdk (nov 07)\include\d3dx9math.inl(997) : error C2059: syntax error : ')' e:\direct x sdk (nov 07)\include\d3dx9math.inl(1012) : error C2146: syntax error : missing ')' before identifier 'p' e:\direct x sdk (nov 07)\include\d3dx9math.inl(1012) : error C2059: syntax error : ')' e:\direct x sdk (nov 07)\include\d3dx9xof.h(79) : error C2146: syntax error : missing ';' before identifier 'dSize' e:\direct x sdk (nov 07)\include\d3dx9xof.h(79) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\direct x sdk (nov 07)\include\d3dx9xof.h(79) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\direct x sdk (nov 07)\include\d3dx9xof.h(163) : error C2061: syntax error : identifier 'SIZE_T' e:\direct x sdk (nov 07)\include\d3dx9xof.h(182) : error C2061: syntax error : identifier 'SIZE_T' e:\direct x sdk (nov 07)\include\d3dx9xof.h(200) : error C2061: syntax error : identifier 'SIZE_T' e:\direct x sdk (nov 07)\include\d3dx9xof.h(204) : error C2061: syntax error : identifier 'SIZE_T' e:\direct x sdk (nov 07)\include\d3dx9xof.h(222) : error C2061: syntax error : identifier 'SIZE_T' e:\direct x sdk (nov 07)\include\d3dx9xof.h(223) : error C2061: syntax error : identifier 'SIZE_T' e:\direct x sdk (nov 07)\include\d3dx9xof.h(242) : error C2061: syntax error : identifier 'SIZE_T' e:\direct x sdk (nov 07)\include\d3dx9xof.h(244) : error C2061: syntax error : identifier 'SIZE_T' e:\direct x sdk (nov 07)\include\d3dx9xof.h(248) : error C2061: syntax error : identifier 'SIZE_T' e:\direct x sdk (nov 07)\include\d3dx9xof.h(249) : error C2061: syntax error : identifier 'SIZE_T'
Any ideas what could be causing this? Thanks in advance for any help :)
Advertisement
Looks like something with the windows headers...although I'm not sure what exactly.
Here's stdafx.h, for reference:

// stdafx.h : include file for standard system include files,// or project specific include files that are used frequently, but// are changed infrequently//#pragma once#pragma comment(lib, "d3d9.lib")#pragma comment(lib, "d3dx9d.lib")#pragma comment(lib, "dxerr9.lib")#pragma comment(lib, "dxguid.lib")#pragma comment(lib, "dinput8.lib")#pragma comment(lib, "dsound.lib")#pragma comment(lib, "winmm.lib")#pragma comment(lib, "comctl32.lib")// Modify the following defines if you have to target a platform prior to the ones specified below.// Refer to MSDN for the latest info on corresponding values for different platforms.#ifndef WINVER				// Allow use of features specific to Windows XP or later.#define WINVER 0x0501		// Change this to the appropriate value to target other versions of Windows.#endif#ifndef _WIN32_WINNT		// Allow use of features specific to Windows XP or later.                   #define _WIN32_WINNT 0x0501	// Change this to the appropriate value to target other versions of Windows.#endif						#ifndef _WIN32_WINDOWS		// Allow use of features specific to Windows 98 or later.#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.#endif#ifndef _WIN32_IE			// Allow use of features specific to IE 6.0 or later.#define _WIN32_IE 0x0600	// Change this to the appropriate value to target other versions of IE.#endif#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers// Windows Header Files:#include <windows.h>// C RunTime Header Files#include <stdlib.h>#include <malloc.h>#include <memory.h>#include <tchar.h>// TODO: reference additional headers your program requires here#include <d3d9.h>#include <d3dx9.h>#include <d3dx9math.h>#include <vector>#include <string>
Go to Tools / Options... and check the include order for your headers. They should go:

1) DirectX SDK
2) Platform/Windows SDK
3) Visual Studio .NET

Occasionally the DirectX team includes headers that are newer versions of what will eventually appear in the platform/windows SDK, so you should always search there first.

e:\direct x sdk (nov 07)\include\d3d9.h(323) : error C2143: syntax error : missing ';' before '__stdcall'


While this is the error, you have to look at the line in the header to see the source of the problem. Its probably a missing type definition because you're searching includes elsewhere before searching the DXSDK.

My free book on Direct3D: "The Direct3D Graphics Pipeline"
My blog on programming, vintage computing, music, politics, etc.: Legalize Adulthood!

Ahh, that seems to have done the trick. I moved the PlatformSDK directory up to the second position and now it builds correctly. Thanks!

This topic is closed to new replies.

Advertisement