Sign in to follow this  
Frogget

Function call problems

Recommended Posts

Frogget    122
When I use this code:
	DirectInput8Create(hInstance, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&pDI, NULL);

	pDI->CreateDevice(GUID_SysKeyboard, &pDID, NULL); 

	pDID->SetDataFormat(&c_dfDIKeyboard); 

	pDID->SetCooperativeLevel(hWnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE); 

	if (pDID) 
		pDID->Acquire(); 

it works fine, but when I put it in this function:
void InitKeyboard(HINSTANCE hInstance)
{
	DirectInput8Create(hInstance, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&pDI, NULL);

	pDI->CreateDevice(GUID_SysKeyboard, &pDID, NULL); 

	pDID->SetDataFormat(&c_dfDIKeyboard); 

	pDID->SetCooperativeLevel(hWnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE); 

	if (pDID) 
		pDID->Acquire(); 
}

I get this error: winmain.obj : error LNK2019: unresolved external symbol "void __cdecl initKeyboard(struct HINSTANCE__ *)" (?initKeyboard@@YAXPAUHINSTANCE__@@@Z) referenced in function _WinMain@16

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this