Archived

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

Madness

DirectInput

Recommended Posts

Madness    122
hey i have been trying for hours and i seem to be doing something wrong the moment i use LPDIRECTINPUT8 (not only that but any DirectInput object) i get the following error error C2501: ''LPDIRECTINPUT8'' : missing storage-class or type specifiers like i haven''t included the library files but i did i include and also dinput8.lib into the project but it doesn''t work actually even when i open the example project that comes with the cd of my book , it gives the exact same error. can somebody help me on this one ?

Share this post


Link to post
Share on other sites
Madness    122
yeah ok ..
i solved it
so you have to copy all the Lib files to the Visual c++ lib folder
as well as the header ...

now that really sucks
and why isn't that in my book or anywhere in the documentation ...

[edited by - madness on May 2, 2002 4:50:22 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Try to check "Include path" in your project settings, e.g. if you are using MSVC++ there is "dinput.h" in standard include directory of version DX5 so if you are including this one no DX8 object can be used. Additional include should point to DXSDK include directory. Don''t forget that directories are searched in order they are entered, so DX8SDK should be before standard include dir.

(for MSVC++ check ''Tools/Options/Directories'')

good luck,
wicasa

Share this post


Link to post
Share on other sites
Madness    122
welyeah that''s there everything else works , i got a 2d game working and done a lot of direct3d

so i really don''t get it

Share this post


Link to post
Share on other sites
Madness    122
ok so i got the library files and header files working

now i can''t acquire a keyboard or anything ..

all i have is this code ( i tries a dozen others but this is the simplest form i guess)

DirectInput8Create(g_hInst, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&g_lpDI, NULL);

g_lpDI->CreateDevice(GUID_SysKeyboard, &g_lpDIDevice, NULL);
g_lpDIDevice->SetDataFormat(&c_dfDIKeyboard);
g_lpDIDevice->SetCooperativeLevel(g_hWnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
if (g_lpDIDevice) r = g_lpDIDevice->Acquire();
if(FAILED (r) ) { SetError("unable to acquire keyboard");}


that''s it ...
this code comes from directx documentation
i tried code from the book and that doesn''t work either
not on my project

however the sample project on the cd-rom does work when i compile it.

but i''m sure i got the exact same code
and i''m also sure i included the header and library files ...

this is confusing...
coz now i got to the part in my book where i should do the happy dance coz DirectInput works ... but it doesnt



Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Well, it would probably help if you knew what the specific error was... try using GetLastError() or something similar and then found out what the error code actually is. Investigate such things by yourself is normally easier than asking others for help, and as everyone says.. RTFM.

Share this post


Link to post
Share on other sites