CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2009
    Posts
    9

    Problem with DirectInput (DirectInput8Create)

    Not sure if it belongs here.

    I've started working with DirectX, trying to create a DLL for my game in order to get state,info and use force feedback with my joysticks.

    Problem is when I try to create a Direct Input 8 object, the compiler throws the following error:

    c:\CPP Projects\DXi\main.cpp|21|undefined reference to `_IID_IDirectInput8A'|
    Code: (note I am creating a simple commandline test app for starters)

    Code:
    #define DIRECTINPUT_VERSION 0x0800
    
    #include <windows.h>
    #include <windowsx.h>
    #include <dinput.h>
    
    #include <iostream.h>
    
    #pragma comment ( lib, "dinput8.lib" )
    #pragma comment ( lib, "dxguid.lib" )
    
    
    LPDIRECTINPUT8 diObject;
    LPDIRECTINPUTDEVICE8 joystick;
    HRESULT hresult;
    
    int main()
    {
    
    // Create a DirectInput device
    hresult = DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (VOID**)&diObject, NULL);
    //if (hresult == FAILED){cout<<"Error creating Dinput object";system("PAUSE");return 0;}
    
        system("PAUSE");
        return 0;
    }


    My IDE is Codeblocks, using newest Windows SDK with DirectX SDK (August 2009)

  2. #2
    Join Date
    Sep 2009
    Posts
    4

    Re: Problem with DirectInput (DirectInput8Create)

    Linker can't find library. Check paths for libraries.

  3. #3
    Join Date
    Nov 2009
    Posts
    1

    Re: Problem with DirectInput (DirectInput8Create)

    your linker is missing "dxguid.lib"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured