Archived

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

Compile error with dinput

This topic is 5274 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

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

Share this post


Link to post
Share on other sites