Skip to main content
GameDev.net gamedev.net
🔒 Locked

DirectInput Linker errors.

Started by bosjoh Oct 12, 1999 at 12:40 AM 8 replies 1.3k views
Original Post
bosjoh
bosjoh
I'm trying to create a directinput object and then creating a keyboard object. All fine, but the linker is giving 'unresolved reference' errors. I've included some code:

bool DirectInputInit(){
HRESULT dirval;
dirval = DirectInputCreate((HINSTANCE)GetWindowLong(windowhandle,GWL_HINSTANCE), DIRECTINPUT_VERSION, &lpDI, NULL);
if( dirval != DI_OK) return(false);
dirval = lpDI->CreateDevice(GUID_SysKeyboard,&lpKeyboard,NULL);
if( dirval != DI_OK) return(false);
dirval = lpKeyboard->SetDataFormat(&c_dfDIKeyboard);
if( dirval != DI_OK) return(false);
dirval = lpKeyboard->SetCooperativeLevel(windowhandle,DISCL_EXCLUSIVE | DISCL_FOREGROUND);
if( dirval != DI_OK) return(false);
lpKeyboard->Acquire();
return(true);
};

pdown
pdown
This may be a silly answer, but did you try linking with dinput.lib?

[This message has been edited by pdown (edited October 08, 1999).]

bosjoh
bosjoh
Yes, I did.
The compiler only moans about UID_SysKeyboard and GUID_SysKey.
felisandria
felisandria
To use GUID, you also need to include
dxguid.lib
and you need to
#define INITGUID

g'luck
-fel

~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
bosjoh
bosjoh
It works!
thanx.
Sixpack
Sixpack
bosjoh,
Are you perhaps using the DX7 borland libs? I know that during the beta, the lib's had an error in them. They should be fine now. Did you upgrade to DX7 gold?

Six

bosjoh
bosjoh
Nope, using VC++ 6.0 libs.
Is this upgrade also available for VC++ 6.0?
I hope it isn't 128 MB (!)
Sixpack
Sixpack
bosjoh,
When I said DX7 gold, I meant the RTM. If you have the final version, you should be fine.

Six

todderod
todderod
You do not need to include the dxguid.lib
AND #define INITGUID as stated above. Just #define INITGUID would do in most cases. Adding the lib would only increase the size of your exe-file. Try without the lib, if it works then, do not use it.

Christoffer Sandberg
todderod@algonet.se

bosjoh
bosjoh
I'll try it.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.