Jump to content
  • Advertisement

Archived

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

shakazed

Compile error with dinput

This topic is 5487 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
Advertisement
Are you putting #define INITGUID somewhere before your headers? Or alternatively linking to dxguid.lib (not both).

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!