Archived

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

simple for you

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi i am using http://www.gamedev.net/reference/articles/article1607.asp i can get it ti work fine alone, but when i add the files to another project, i get this error: C:\paymon\OhBehave-2.2.3\ohdisplay\CInput8.cpp(20) : error C2065: 'DirectInput8Create' : undeclared identifier C:\paymon\OhBehave-2.2.3\ohdisplay\CInput8.cpp(20) : error C2065: 'IID_IDirectInput8' : undeclared identifier i have these header files: #include <dinput.h> #include <stdafx.h> #include "CInput8.h" this is where the error occurs: bool Init_CInput8(HINSTANCE h) { if (FAILED(DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&lpdi, NULL))) return false; for (int i = 0; i < 256; i++) keypress_state = 0; return true; } i am making another dumb mistake, i know .... what is it? [edited by - paymonh on July 25, 2002 2:05:47 PM] [edited by - paymonh on July 25, 2002 5:17:41 PM]

Share this post


Link to post
Share on other sites
Assuming you actually have the DX8 SDK installed and you''re using MSVC:


1. Go to the Tools menu in MSVC and select Options...

2. Click on the "Directories" tab.

3. Select "Include files" under the "Show directories for" box.

4. Add a new entry to the list with the location of the include files in the DX8 SDK, for example "C:\DXSDK\INCLUDE".

5. Click on the new entry you made and drag it to the *top* of the list so that it''s the first entry. This step is very important.

6. Select "Library files" under the "Show directories for" box.

7. Add a new entry pointing to the SDK library files, e.g. "C:\DXSDK\LIB"

8. Drag that entry to the top of the libraries list in the same way as you did for the includes.

9. Recompile and enjoy.

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
do you have the "X:\DXSDK\INCLUDE" (replace X with the drive u installed DXSDK) as the top most item in the list (in the Tools/Options/Directories menu-tab)? Are you sure? check again...
(cuz i think compiler finds the dinput.h inside your MSVC default include folder (which is actually DX5) instead of DX8 dinput.h which is present in X:\DXSDK\INCLUDE folder.

Also if you are using only DX8 Input (i think you are...) then include only dinput8.lib. you don''t need dinput.lib.

(you can also copy all the files in X:\DXSDK\INCLUDE to the MSVC default include folder overwriting the existing ones!, though not recommended. MSVC default include folder is C:\Program Files\Microsoft Visual Studio\VC98\Include)

does this help??

Share this post


Link to post
Share on other sites
believe me:

dxsdk is included on top of the list
these are the libs linked
dinput8.lib dxguid.lib ddraw.lib dplayx.lib

problem not solved yet



another thing:

when i write click on DirectInput8Create and choose "go to definition", nothing happens

[edited by - paymonh on July 25, 2002 2:39:10 PM]

Share this post


Link to post
Share on other sites
did u try copying the files from the DXSDK\INCLUDE to MSVC include folder...
and ARE YOU CERTAIN ABOUT THE INCLUDE ITEM??? THE LIB ITEM MAY BE ON THE TOP, BUT INCLUDE ITEM ALSO SHOULD BE ON THE TOP...

(I don''t see any other problems!)

Share this post


Link to post
Share on other sites
First things first. You should always include local headers before library headers or platform headers. You can create unknown dependancies otherwise.

Try doing this and see what happens.

Place this before the include for DInput.h.
#define DIRECTINPUT_VERSION 0x800


Or try this and see what happens. It will give you an error, but lets see what the error is.

if (FAILED(DirectInputCreate(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&lpdi, NULL)))


Stephen Manchester
Senior Technical Lead
Virtual Media Vision, Inc.
stephen@virtualmediavision.com
(310) 930-7349

[edited by - smanches on July 25, 2002 2:59:47 PM]

Share this post


Link to post
Share on other sites
hi

#define DIRECTINPUT_VERSION 0x0800 solved the previous two errors,

thank you


however, now i get this err:
C:\paymon\OhBehave-2.2.3\ohdisplay\Scheduler\DrawingClass.cpp(572) : error C2065: ''DirectInputCreateEx'' : undeclared identifier

i am working on this huge program
the person before me used dirextx 7
he had a #define DIRECTINPUT_VERSION 0x0700 before dinput, and that is why the errors were occuring
now that i removed that, i get the new err

Share this post


Link to post
Share on other sites
This is another legacy situation from using Dinput 7. This function no longer exists. You''ll have to figure out the reason he used this and just use DirectInput8Create. That is the only crreate function needed in Dinput8.

Stephen Manchester
Senior Technical Lead
Virtual Media Vision, Inc.
stephen@virtualmediavision.com
(310) 930-7349

Share this post


Link to post
Share on other sites
you can''t use two different versions of the same component of dx in one application (dinput7 & dinput8, for instance). either code the entire app for di7, or fix the old code to use di8.

---
Come to #directxdev IRC channel on AfterNET

Share this post


Link to post
Share on other sites