Results 1 to 2 of 2

Thread: Direct Input problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2001
    Location
    Québec, Canada
    Posts
    131

    Direct Input problem

    Hello,
    While following a direct input tutorial, I got this error :
    error LNK2001: unresolved external symbol _GUID_SysMouse
    I have link to dinput.lib, and here's my code:

    PHP Code:
    #include <dinput.h>
    #include <windows.h>

    LPDIRECTINPUT lpdi;
    LPDIRECTINPUTDEVICE lpdiKeyboardlpdiMouse;

    LRESULT CALLBACK WndProc(HWND hWndUINT MsgWPARAM wParamLPARAM lParam)
    {
        switch(
    Msg)
        {
        case 
    WM_CLOSE:
            {
                
    DestroyWindow(hWnd);
            }
            break;
        case 
    WM_DESTROY:
            {
                
    PostQuitMessage(0);
            }
            break;
        default:
            return 
    DefWindowProc(hWnd,Msg,wParam,lParam);
        }
        return 
    0;
    }

    int APIENTRY WinMain(HINSTANCE hInstance,
                         
    HINSTANCE hPrevInstance,
                         
    LPSTR     lpCmdLine,
                         
    int       nCmdShow)
    {
         
    WNDCLASSEX wc;

        
    wc.cbClsExtra 0;
        
    wc.cbSize sizeof(wc);
        
    wc.cbWndExtra 0;
        
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW);
        
    wc.hCursor LoadCursor(NULL,IDC_ARROW);
        
    wc.hIcon wc.hIconSm LoadIcon(NULL,IDI_APPLICATION);
        
    wc.hInstance hInstance;
        
    wc.lpfnWndProc WndProc;
        
    wc.lpszClassName "DInput";
        
    wc.lpszMenuName NULL;
        
    wc.style 0;

        
    RegisterClassEx(&wc);
        
        
    HWND hWnd CreateWindowEx(NULL,"DInput","DInput",WS_OVERLAPPEDWINDOW,0,0,800,700,NULL,NULL,hInstance,NULL);

        
    ShowWindow(hWnd,nCmdShow);
        
    UpdateWindow(hWnd);

        
    DirectInputCreate(hInstance,DIRECTINPUT_VERSION,&lpdi,NULL);
        
    lpdi->CreateDevice(GUID_SysKeyboard,&lpdiKeyboard,NULL);
        
    lpdi->CreateDevice(GUID_SysMouse,&lpdiMouse,NULL);

        
    MSG Msg;

        while(
    GetMessage(&Msg,NULL,0,0))
        {
            
    TranslateMessage(&Msg);
            
    DispatchMessage(&Msg);
        }

        return 
    0;

    Someone know why I get this error (I get the same error for the Keyboard)

    Thanks for your help.
    Khavoerm Irithyl

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    You need to define something before including dinput.h. something like INITGUID (look it up in DirectX SDK help):
    Code:
    #define INITGUID
    #include <windows.h> // should be always included first
    #include <dinput.h>
    If you have several files, you should define this only ONCE.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

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