trouble with DirectInput

Started by
6 comments, last by Username_ 21 years, 4 months ago
help me! im trying to initalize a DirectInput object and i get this darn error i dont know what to do with, i think it may have somthing to do with using dx7 but having dx8... i dont konw... please help... and any more info you need, just ask code is in c++ -------CODE that i think is the problem: // Create our DirectInput object if ( FAILED(hr = IDirectInputDevice8(hInst, DIRECTINPUT_VERSION, IID_IDirectInput7, ( void ** )&lpDI, NULL ) ) ) return hr; -------MSVC compile time errors: --------------------Configuration: Version F Monkey - Win32 Debug-------------------- Compiling... monkey.cpp c:\directxsdk\include\dinput.h: DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800 C:\DirectxSDK\samples\Multimedia\DirectDraw\Version F Monkey\monkey.cpp(321) : error C2259: 'IDirectInputDevice8A' : cannot instantiate abstract class due to following members: c:\directxsdk\include\dinput.h(1852) : see declaration of 'IDirectInputDevice8A' C:\DirectxSDK\samples\Multimedia\DirectDraw\Version F Monkey\monkey.cpp(321) : warning C4259: 'long __stdcall IDirectInputDevice8A::QueryInterface(const struct _GUID &,void ** )' : pure virtual function was not defined c:\directxsdk\include\dinput.h(1855) : see declaration of 'QueryInterface' --------- ...Warnings comming out the ying-yang... --------- C:\DirectxSDK\samples\Multimedia\DirectDraw\Version F Monkey\monkey.cpp(321) : warning C4259: 'long __stdcall IDirectInputDevice8A::SetActionMap(struct _DIACTIONFORMATA *,const char *,unsigned long)' : pure virtual function was not defined c:\directxsdk\include\dinput.h(1887) : see declaration of 'SetActionMap' C:\DirectxSDK\samples\Multimedia\DirectDraw\Version F Monkey\monkey.cpp(321) : warning C4259: 'long __stdcall IDirectInputDevice8A::GetImageInfo(struct _DIDEVICEIMAGEINFOHEADERA *)' : pure virtual function was not defined c:\directxsdk\include\dinput.h(1888) : see declaration of 'GetImageInfo' Error executing cl.exe. Version F Monkey.exe - 1 error(s), 32 warning(s) [edited by - Username_ on December 9, 2002 7:47:47 AM]
Advertisement
Ooooo, i fixed it! but after fixing it ( by defining DIRECTINPUT_VERSION to 0x0700 before including dinput.h)i got another error

if anyone would be so generous as to help me, this is what it spat out at me:
--------------------Configuration: Version F Monkey - Win32 Debug--------------------
Compiling...
monkey.cpp
c:\directxsdk\samples\multimedia\common\include\diutil.h(24) : error C2146: syntax error : missing ';' before identifier 'pdidDevice'
c:\directxsdk\samples\multimedia\common\include\diutil.h(24) : error C2501: 'LPDIRECTINPUTDEVICE8' : missing storage-class or type specifiers
c:\directxsdk\samples\multimedia\common\include\diutil.h(24) : error C2501: 'pdidDevice' : missing storage-class or type specifiers
c:\directxsdk\samples\multimedia\common\include\diutil.h(35) : error C2146: syntax error : missing ';' before identifier 'm_pDI'
c:\directxsdk\samples\multimedia\common\include\diutil.h(35) : error C2501: 'LPDIRECTINPUT8' : missing storage-class or type specifiers
c:\directxsdk\samples\multimedia\common\include\diutil.h(35) : error C2501: 'm_pDI' : missing storage-class or type specifiers
c:\directxsdk\samples\multimedia\common\include\diutil.h(39) : error C2146: syntax error : missing ';' before identifier 'm_diaf'
c:\directxsdk\samples\multimedia\common\include\diutil.h(39) : error C2501: 'DIACTIONFORMAT' : missing storage-class or type specifiers
c:\directxsdk\samples\multimedia\common\include\diutil.h(39) : error C2501: 'm_diaf' : missing storage-class or type specifiers
c:\directxsdk\samples\multimedia\common\include\diutil.h(46) : error C2061: syntax error : identifier 'LPDIRECTINPUTDEVICE8'
c:\directxsdk\samples\multimedia\common\include\diutil.h(53) : error C2061: syntax error : identifier 'DIACTIONFORMAT'
c:\directxsdk\samples\multimedia\common\include\diutil.h(54) : error C2061: syntax error : identifier 'DIACTIONFORMAT'
Error executing cl.exe.

monkey.obj - 12 error(s), 0 warning(s)



this time there is not even any complaints directly about my code so yet again i am at a loss for what to do.

help! please and thanks

[edited by - Username_ on December 8, 2002 9:03:10 PM]

[edited by - Username_ on December 8, 2002 10:27:28 PM]
hmmm... i have determined that it has something to do with the whole GUID unique identifier thing... what exactly i am yet to determine, i still dont quite understand it

You need to create a directinput8 object. With that you can then create direct input devices.

pseudo code:

LPDIRECTINPUT8 lpdi;
LPDIRECTINPUTDEVICE8 lpdid;


DirectInput8Create(application instance, DI version, DI interface guid, &lpdi, NULL);

lpdi->CreateDevice(device guid, &lpdid, NULL);

I''m shit at explaining things. I could just send you the code to my input subsystem. Let me know if this would help.

eb.


Frik! computer crashed so i lost my post. short version is as follows:

i still dont really understand but please send the code to me, i think it will help me out tonnes. my email is nobody_91@hotmial.com

please and thanks
ok, well my program was giving me too much hassle so i scraped the whole thing and started again. the aformentioned problems are nolonger applicable however, new ones have arisen. i found a directinput tutorial on MSDN that helped me alot this time, basicly all i have had to do is cut and paste code.

this is my current probelm if anyone cares to help:

my program will compile just fine without error, but when i go to build (or link or whatever it is called) it i get this:

--------------------Configuration: Version F Monkey - Win32 Debug--------------------
Linking...
monkey.obj : error LNK2001: unresolved external symbol _c_dfDIKeyboard
monkey.obj : error LNK2001: unresolved external symbol _DirectInput8Create@20
Debug/Version F Monkey.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

Version F Monkey.exe - 3 error(s), 0 warning(s)


i have no idea why i get this or how to fix it. please help


[edited by - Username_ on December 9, 2002 7:52:04 AM]
You forgot to link the dinput8.lib and dxguid.lib libraries.....

Choose: Projects -> Settings (Alt+F7)-> Settings for: All Configurations -> Add DINPUT8.LIB and DXGUID.LIB to object/library modules...
--------<a href="http://www.icarusindie.com/rpc>Reverse Pop Culture
yes, yes i did, thanks for the help


[edit]i had more problems, but... all my problems are FINALY fixed (for the time being)(i think) thank you guys for all your help[/edit]


[edited by - Username_ on December 9, 2002 3:07:26 PM]

This topic is closed to new replies.

Advertisement