• ### Popular Now

• 15
• 15
• 11
• 9
• 10

#### Archived

This topic is now archived and is closed to further replies.

# Newbie + DirectInput = This Topic

This topic is 5773 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey all, I''m trying to create my own 3d engine (like the rest of us ) but suffer from complete newbieism. Every time I try to compile my program, I get the same error messages from DirectInput. I''m sure there is a really simple fix for this, but right now it is beyond me! Any help would be greatly appriciated This is the compile error I keep getting, well a section of it anyway:
input.cpp
C:\Program Files\DevStudio\VC\INCLUDE\dinput.h: DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800
C:\Program Files\DevStudio\VC\INCLUDE\dinput.h(646) : error C2501: ''UINT_PTR'' : missing decl-specifiers
C:\Program Files\DevStudio\VC\INCLUDE\dinput.h(646) : error C2146: syntax error : missing '';'' before identifier ''uAppData''
C:\Program Files\DevStudio\VC\INCLUDE\dinput.h(646) : error C2501: ''uAppData'' : missing decl-specifiers
C:\Program Files\DevStudio\VC\INCLUDE\dinput.h(658) : error C2501: ''UINT_PTR'' : missing decl-specifiers
C:\Program Files\DevStudio\VC\INCLUDE\dinput.h(658) : error C2146: syntax error : missing '';'' before identifier ''uAppData''
C:\Program Files\DevStudio\VC\INCLUDE\dinput.h(658) : error C2501: ''uAppData'' : missing decl-specifiers
C:\Program Files\DevStudio\VC\INCLUDE\dinput.h(1056) : error C2501: ''UINT_PTR'' : missing decl-specifiers
C:\Program Files\DevStudio\VC\INCLUDE\dinput.h(1056) : error C2146: syntax error : missing '';'' before identifier ''uData''
C:\Program Files\DevStudio\VC\INCLUDE\dinput.h(1056) : error C2501: ''uData'' : missing decl-specifiers
C:\Program Files\DevStudio\VC\INCLUDE\dinput.h(1209) : error C2501: ''UINT_PTR'' : missing decl-specifiers
C:\Program Files\DevStudio\VC\INCLUDE\dinput.h(1209) : error C2146: syntax error : missing '';'' before identifier ''uAppData''
C:\Program Files\DevStudio\VC\INCLUDE\dinput.h(1209) : error C2501: ''uAppData'' : missing decl-specifiers


##### Share on other sites
Just for the record, I am having this same exact problem. I thought it was my compiler (I am using MSVC++ 4.0), but now that someone else has this problem, there must be a setting that I am overlooking (unless sledge also has an older compiler).

And I am sure it is not my code, because I have tried compiling both ShiningKnight''s game tutorials and the game from "OpenGL Game Programming."

##### Share on other sites
Included windows.h?

##### Share on other sites
Yes, sir, it is the first one included.

##### Share on other sites
Okay. Where is the DXSDK installed on your system? It looks as though it''s grabbing header files from your VC Include directory. That might be the way you intentionally have it set up, but if the most recent DX headers are anywhere else, put the directory first on your directory list for Include Files within the VC IDE.

Later,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//

[if you have a link proposal, email me.]

##### Share on other sites
No, it''s not a DX include problem, it''s your old compiler. Include this file: <basetsd.h> and you should be fine.

##### Share on other sites
I'm not sure if it is the old compiler, because I'm using MSVC++ 5.0 (yes, i guess that is still old to, but hey ) and it just wont work. I tried including basetsd.h and though it fixed the previous problem I had, now it gives me unresolved external symbols.

Here is exactly what went wrong:
--------------------Configuration: engine - Win32 Debug--------------------Compiling...main.cppC:\Program Files\DevStudio\VC\INCLUDE\dinput.h: DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800engine.cppC:\Program Files\DevStudio\VC\INCLUDE\dinput.h: DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800input.cppC:\Program Files\DevStudio\VC\INCLUDE\dinput.h: DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800Linking...input.obj : error LNK2001: unresolved external symbol _c_dfDIKeyboardinput.obj : error LNK2001: unresolved external symbol _GUID_SysKeyboardinput.obj : error LNK2001: unresolved external symbol _c_dfDIMouseinput.obj : error LNK2001: unresolved external symbol _GUID_SysMouseinput.obj : error LNK2001: unresolved external symbol _DirectInput8Create@20input.obj : error LNK2001: unresolved external symbol _IID_IDirectInput8A...\bin\debug\engine.exe : fatal error LNK1120: 6 unresolved externalsError executing link.exe.engine.exe - 7 error(s), 0 warning(s)

[edited by - sledge on May 31, 2002 10:55:32 PM]

##### Share on other sites
To fix the DIRECTINPUT_VERSION errors, add this before you include dinput.h:
#define DIRECTINPUT_VERSION 0x0800

To fix the other errors, add dinput8.lib to the linker''s list of libraries.

##### Share on other sites
Possibly
dxguid.lib
also

Later,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//

[if you have a link proposal, email me.]

##### Share on other sites
IndirectX: Thanks, "basetsd.h" did it for me.

Also, does anyone know where the sinf, cosf, and sqrtf functions are located? ShiningKnight uses them in his tutorials but I am getting undeclared indentifier errrors.

And are there any other header files I should include when using an older compiler. It seems like I always get errors when I use code made for 6.0.