   Problem setting up DirectInput
  I want to be able to get input from a controller in my program, so I found a tutorial on DirectInput. Well I include dinput.h and link dinput8.lib and dxguid.lib like the tutorial says. But when I call DirectInput8Create like so:DirectInput8Create(hInstance, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)DIObject, NULL);I get this link error:--------------------Configuration: Direct Input Test - Win32 Debug--------------------Compiling...Direct Input Test.cppLinking...Direct Input Test.obj : error LNK2001: unresolved external symbol _IID_IDirectInput8ADebug/Direct Input Test.exe : fatal error LNK1120: 1 unresolved externalsError executing link.exe.Creating browse info file...Direct Input Test.exe - 2 error(s), 0 warning(s)What exactly is going wrong? Thanks in advance.   
  I think you need to link in dinput.lib as well. I don't have a reason why though, sorry.   ;  =( Nope. Gives same error.   ;  Did you #define DIRECTINPUT_VERSION before including dinput.h?Which tutorial is it you are working from?;  [edit] Oh, sorry. I hadn't read that part of your post.I do believe you need to link to dxguid.lib as well.jfl.[Edited by - jflanglois on May 25, 2006 3:58:20 AM];  I did link dxguid.lib. And DIRECTINPUT_VERSION is defined in dinput.h like so:#ifndef DIRECTINPUT_VERSION#define DIRECTINPUT_VERSION    DIRECTINPUT_HEADER_VERSIONThe tutorial doesn't tell me to define it as anything. Just that it's defined in the direct input header and represents the current version. So should I define it as something different? And if so, what?And the tutorial I'm doing is at Two-Kings.   ;  That's odd, this guy had a similar problem, but it looks like you have done all of what's needed. Lat suggestion is to make sure that you linked in the libraries for the current project configuration you are on.   ;  The only thing I remember - if you REALLY linked dxguid.lib - is if you didn't use a MS compiler. I remember some had problems with the COM stuff in dxguid.lib.There is another way for getting these interface names by #define-ing instead of linking dxguid.lib.#define INITGUID or something like that - I'm not sure. A quick google search should do the trick.Or you should try MS VS 2003 Toolkit (if this really is an compiler issue).   ;  Well, added what you said in your post to that other guy, before I included dinput.h:#include <objbase.h>#define INITGUID#include <initguid.h>And now it works. Thanks for help all. And thanks for answer Drew.EDIT: Oops. More dinput link errors. Direct input just doesn't like me I don't think.Okay. Well after I did the stuff Drew said, I got the creation of the LPDIRECTINPUT8 object to work. Then I read on in the tutorial and make a LPDIRECTINPUTDEVICE8 object for the keyboard and create it, as seen below. Then, the next thing I try to do, the Keyboard->SetDataFormat(&c_dfDIKeyboard), gives me link errors.The code:bool InitializeDirectInput(){if(FAILED(DirectInput8Create(hInstance, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)DIObject, NULL))){MessageBox(NULL, "DirectInput8Create failed.", "Error", MB_OK | MB_ICONSTOP);return FALSE;}if(FAILED(DIObject->CreateDevice(GUID_SysKeyboard, &Keyboard, NULL))){MessageBox(NULL, "CreateDevice for the keyboard failed.", "Error", MB_OK | MB_ICONSTOP);return FALSE;}if(FAILED(Keyboard->SetDataFormat(&c_dfDIKeyboard))){MessageBox(NULL, "SetDataFormat for the keyboard failed.", "Error", MB_OK | MB_ICONSTOP);return FALSE;}return TRUE;}The link errors:--------------------Configuration: Direct Input Test - Win32 Debug--------------------Compiling...Direct Input Test.cppLinking...dinput8.lib(dilib2.obj) : fatal error LNK1103: debugging information corrupt; recompile moduleError executing link.exe.Creating browse info file...Direct Input Test.exe - 1 error(s), 0 warning(s)Well. Whats it griping about this time? Any help would be appreciated. Thanks in advance.[Edited by - K A Z E on May 25, 2006 4:40:46 PM];  Try doing Build->Clean Solution and then recompile.jfl.   