Compile error /dinput)

Started by
3 comments, last by shakazed 20 years, 9 months ago
Okay, I know this is kinda stupid but I get a "missing ; before *" error when I run this code. I´m linking dinput8.lib and the header dinput.h (as you can see below). I´m really tired so plz don´t hit me for asking what I´ve missed.

//This class sets up a camera and uses DirectInput 

//to rotate, and move the camera

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

#define DXERRORCHK(function,type) if(FAILED(function)){MessageBox(NULL,type,"Error",MB_OK); return false;}

class CCamera
{
public:
	bool Initialize(HINSTANCE hInstance);

private:
	IDirectInput8 *p_iDInput8; //Create a pointer to an instance of a dinput object

	IDirectInputDevice8 *p_iDInputDevice8;
};

bool CCamera::Initialize(HINSTANCE hInstance)
{
	//Create the dinput object

	DirectInput8Create(hInstance, DIRECTINPUT_VERSION, IID_DirectInput8,
		(VOID**)p_iDInput8,NULL);
	
	//Create our keyboard device

	DXERRORCHK(p_iDInput->CreateDevice(GUID_SysKeyboard,&p_iDInputDevice8,NULL),
		"Failed to create keyboard device");
	
	//Set data format

	DXERRORCHK(p_iDInputDevice8->SetFormat(&c_dfDIKeyboard),
		"Failed to set keyboard format");

}
Bad Monkey Productions
Advertisement
Just a thought, but if you''re providing the paths to the DirectX SDK by using the Tools->Options->Directories tab (in vc6 at least), make sure the SDK entries are above the visual studio directories.

If you don''t, the compiler includes the DirectX files that came with VC6, which will be DirectX v3, which won''t have any DInput8 stuff.

Of course, if you''re not using visual studio, this is all guff...
That si done, I already render a scene with direct3d9 so it´s not a problem.



Bad Monkey Productions
I just tried your code in my vc6 and it compiled fine (bar a couple of typos ). Hmmm...
Heh got it working, forgot that I reinstalled the sdk Thanks for the help anyhow

[edited by - shakazed on July 8, 2003 4:41:11 PM]

This topic is closed to new replies.

Advertisement