Thread: DirectX9 _GUID unresolved external - compile time error.

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    58

    DirectX9 _GUID unresolved external - compile time error.

    I am getting an unresolved external for the following:
    c_dfDIKeyboard
    GUID_SysKeyboard
    DirectInput8Create@20
    IID_IDirectInput8A


    It seems that it would be due to me not linking things properly...

    But my linker has additional libraries under:
    C:/Program Files/Microsoft DirectX SDK (August 2007)/Lib/x86

    And additional includes under:
    C:/Program Files/Microsoft DirectX SDK (August 2007)/Includes


    ....and both of those directories are correct for me.


    So here is a huge chunk of code.

    Code:
    #ifndef _INPUT_H_
    #define _INPUT_H_
    
    #include "d3d9.h"
    #include "d3dx9.h"
    #include <dinput.h>
    #pragma comment(lib, "d3dx9.lib")
    #pragma comment(lib, "d3d9.lib")
    class InputDevice
    {
    public:
    	~InputDevice(void);
    	LPDIRECTINPUT8 Interface;
    	LPDIRECTINPUTDEVICE8 Device;
    protected:
    	InputDevice(void);
    private:
    };
    
    #endif
    Code:
    #ifndef _KEYBOARD_H_
    #define _KEYBOARD_H_
    #include "inputdevice.h"
    #include <iostream>
    #include "keys.h"
    using namespace std;
    class KeyboardDevice : public InputDevice
    {
    public:
    	KeyboardDevice(void){}
    	KeyboardDevice(HWND hWnd, HINSTANCE hInstance);
    	~KeyboardDevice(void);
    	void Update(void);
    	bool Pressed(Key key);
    	void Print(void);
    //protected:
    	unsigned char state[256], pState[256];
    };
    #endif
    Code:
    #include "window.h"
    #include "point.h"
    #include "graphicdevice.h"
    #include "application.h"
    #include <windows.h>
    #include "keyboarddevice.h"
    //#define KEY_DOWN(vk_code) (GetAsyncKeyState(vk_code) & 0x8000 ? 1 : 0)
    //#define KEY_UP(vk_code) (GetAsyncKeyState(vk_code) & 0x8000 ? 0 : 1)
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
    {
    
    	Window AppWindow(hInstance, nShowCmd, Point(500, 500), Point(50, 50), FALSE);
    	GraphicDevice Graphics(AppWindow.Handle());
    	Application Program = Application();
    	KeyboardDevice Keyboard(AppWindow.Handle(), hInstance);
    	MSG WindowsMessages;
    
    	Program.LoadContent();
    	while(1)
    	{
    		if(Keyboard.Pressed(Keys::Escape)) PostMessage(AppWindow.Handle(), WM_DESTROY, 0, 0);
    		while(PeekMessage(&WindowsMessages, NULL, 0, 0, PM_REMOVE))
    		{
    			TranslateMessage(&WindowsMessages);
    			DispatchMessage(&WindowsMessages);
    		} if(WindowsMessages.message == WM_QUIT) break;
    
    		Keyboard.Update();
    		Program.DrawStart(Graphics);
    		Program.Draw();
    		Program.DrawEnd(Graphics);
    	}
    	Program.UnloadContent();
    	//Graphics.Dispose();
    	return WindowsMessages.wParam;
    }

    ...If you need more code than this, let me know and I will post it.

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    You must link with dxguid.lib, dinput8.lib and dinput.lib

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 04:09 AM
  2. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  3. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  4. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  5. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM