Click to See Complete Forum and Search --> : Problem with DirectInput (DirectInput8Create)


avrs
September 20th, 2009, 08:04 AM
Not sure if it belongs here.

I've started working with DirectX, trying to create a DLL for my game in order to get state,info and use force feedback with my joysticks.

Problem is when I try to create a Direct Input 8 object, the compiler throws the following error:

c:\CPP Projects\DXi\main.cpp|21|undefined reference to `_IID_IDirectInput8A'|

Code: (note I am creating a simple commandline test app for starters)


#define DIRECTINPUT_VERSION 0x0800

#include <windows.h>
#include <windowsx.h>
#include <dinput.h>

#include <iostream.h>

#pragma comment ( lib, "dinput8.lib" )
#pragma comment ( lib, "dxguid.lib" )


LPDIRECTINPUT8 diObject;
LPDIRECTINPUTDEVICE8 joystick;
HRESULT hresult;

int main()
{

// Create a DirectInput device
hresult = DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (VOID**)&diObject, NULL);
//if (hresult == FAILED){cout<<"Error creating Dinput object";system("PAUSE");return 0;}

system("PAUSE");
return 0;
}




My IDE is Codeblocks, using newest Windows SDK with DirectX SDK (August 2009)

antslag
September 29th, 2009, 07:45 AM
Linker can't find library. Check paths for libraries.

_Crn
November 25th, 2009, 01:31 PM
your linker is missing "dxguid.lib"