Jump to content
  • Advertisement

Archived

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

EmpyrealHell

Direct Input Class = Linker Errors

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

I''m creating a class for my direct input code, and when I try to write the initialization member function, it gives me about 7 linker errors when I compile, any ideas? //cDInput.h
class cDInput
{private:
	LPDIRECTINPUT		lpDI;
	LPDIRECTINPUTDEVICE	DeviceKeyboard;
	LPDIRECTINPUTDEVICE	DeviceMouse;
	DIMOUSESTATE		Mouse_State;
	char			Keys[256];
 public:
	cDInput();
	~cDInput();
	bool	fCreate(HWND hWndMain,HINSTANCE hInstance);
	bool	fError(int ErrNo,HWND hWnd);
}
//cDInput.cpp
bool cDInput::fCreate(HWND hWndMain,HINSTANCE hInstance)
{	if(!USE_INPUT)return true;
	if(DirectInputCreate(hInstance, DIRECTINPUT_VERSION, &lpDI, NULL)!=DI_OK)return fError(0x0001,hWndMain);
	
	//Keyboard Init
	if(lpDI->CreateDevice(GUID_SysKeyboard, &DeviceKeyboard, NULL)!=DI_OK)return fError(0x0002,hWndMain);
	if(DeviceKeyboard->SetDataFormat(&c_dfDIKeyboard)!=DI_OK)return fError(0x0003,hWndMain);
	if(DeviceKeyboard->SetCooperativeLevel(hWndMain, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE)!=DI_OK)return fError(0x0004,hWndMain);
	if(DeviceKeyboard->Acquire()!=DI_OK)return fError(0x0005,hWndMain);
	
	//Mouse Init
	if(lpDI->CreateDevice(GUID_SysMouse, &DeviceMouse, NULL)!=DI_OK)return fError(0x0006,hWndMain);
	if(DeviceMouse->SetDataFormat(&c_dfDIMouse)!=DI_OK)return fError(0x0007,hWndMain);
	if(DeviceMouse->SetCooperativeLevel(hWndMain, DISCL_FOREGROUND | DISCL_EXCLUSIVE)!=DI_OK)return fError(0x0008,hWndMain);
	HANDLE HevtMouse = CreateEvent(0, 0, 0, 0);
	if(DeviceMouse->SetEventNotification(HevtMouse)!=DI_OK)return fError(0x0009,hWndMain);
	DIPROPDWORD dipdw = { { sizeof(DIPROPDWORD), sizeof(DIPROPHEADER), 0, DIPH_DEVICE,}, 32};
	if(DeviceMouse->SetProperty(DIPROP_BUFFERSIZE, &dipdw.diph)!=DI_OK)return fError(0x000A,hWndMain);
	if(DeviceMouse->Acquire()!=DI_OK)return fError(0x000B,hWndMain);
	return true;
}
//These are the errors it returns:
Linking...
cDInput.obj : error LNK2001: unresolved external symbol _GUID_SysMouse
cDInput.obj : error LNK2001: unresolved external symbol _GUID_SysKeyboard
dinput.lib(dilib1.obj) : error LNK2001: unresolved external symbol _GUID_ZAxis
dinput.lib(dilib1.obj) : error LNK2001: unresolved external symbol _GUID_YAxis
dinput.lib(dilib1.obj) : error LNK2001: unresolved external symbol _GUID_XAxis
dinput.lib(dilib2.obj) : error LNK2001: unresolved external symbol _GUID_Key
Debug/Shell.exe : fatal error LNK1120: 6 unresolved externals
Error executing link.exe.

Share this post


Link to post
Share on other sites
Advertisement
use
#pragma comment(lib, "dxguid.lib")

quote:

Dick''s Lemma:
"Just because you`re paranoid doesn`t mean they`re not out to get you."

The Programmer''s dilemma:
"Programming is like sex: One mistake and you''re providing
support for a lifetime."

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!