# compiling error when include DirectInput

## Recommended Posts

hi, everyone: I try to include direct input into my program, but have compiling error, please help I installed DirectX SDK 2006 December version into my computer, Using Visual C++ 2005 or Visual C++ 6.0 , both get:
Quote:
 error C2146: syntax error : missing ';' before identifier 'pIDirectInput'
I already include <dinput.h> here is the code:
#include <dinput.h>
#define ITEMS_NUM 10

static LPDIRECTINPUT8 pIDirectInput;


tracing into dinput.h file, I do found
Quote:
 typedef struct IDirectInput8 *LPDIRECTINPUT8;
that means, it's indeed defined inside dinput.h, why still error? also i found:
Quote:
 #define DIRECTINPUT_VERSION 0X0800
suspicious, but I don't know if it's relevant. I did not do anything about it in my program. I didnot use UNICODE in vc6, but vc2005 the unicode is a default, both have this error. could anybody tell me, what is wrong ? thanks winston

##### Share on other sites
Have you linked in the libraries dinput8 & dxguid?

##### Share on other sites
yes, I did. in vc6,

project -- settings -- link -- object/library modules

I filled in

dxerr.lib dxguid.lib dinput8.lib d3dx9d.lib d3d9.lib winmm.lib comctl32.lib

//

and all the other features already worked (I created d3d device, show texture, all ok, the resulting 3d graphics just fine, then try to include dinput today above of that)

besides, this is a compiling error, lib link seems irrelevant.

thank you.

winston.

##### Share on other sites
well, problem solved.

I seach the dinput.h file, found in my computer, there are several of them.

the VC6, VC2003 (i intall all of them) themself HAVE the dinput files, and when I installed the DirectX SDK, there added another one.

then I check the VC6.0 directory options, find the direct SDK is in the last option position.

so that means, the program included the vc version dinput.h when it met
#include <dinput.h> ,since it's the old version one, there is no LPDIRECTINPUT8.

the solotion is changing the position of vc directory options, make the DirectX SDK directory first choice. the compiling went through without problems.

thanks though.

winston.

##### Share on other sites
Why do you have VC6 and VC2003 / 2005? That's like dual booting Windows XP with Windows 3.11.

##### Share on other sites
well, i know what i did sounds a little dumb. actually I have three IDEs installed. VC6, VC2003 and VC2005. amazingly, they don't interfere each other, all three can work just fine.

the reason I installed all of them, is that I have downloaded many directx sample code by other people, (I am still learning), they are different projects, I don't want establish projects (solution). otherwise I don't know the errors result from my mistakes or the original code. so i simply install all the IDEs, compile the sample code directly. ;P

the price a learner has to pay.

winston.

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627651
• Total Posts
2978407

• 10
• 12
• 22
• 13
• 33