Thread: DirectX 8: Creating the DirectX Object

  1. #1
    Toraton
    Guest

    DirectX 8: Creating the DirectX Object

    Okay, my problem is that I get the error "Main.obj : error LNK2001: unresolved external symbol _Direct3DCreate8@4" when I attempt to link my project. I assume this means it cannot find the Direct3DCreate8 function. Yes, I have linked the included files. Here is my code.
    Code:
    #include "include.h"
    #include <d3d8.h>
    
    HRESULT SetupD3D();
    
    
    HWND				hWnd;
    LPDIRECT3D8			g_pD3D = NULL;
    LPDIRECT3DDEVICE8	dxMainDevice;
    
    
    
    int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nShowCmd)
    {
    	Window wiMain(hWnd, hInst);
    	wiMain.Setup(DefaultWndProc, "MainClass");
    	wiMain.Create("Main Window");
    	wiMain.Show();
    
    	SetupD3D();
    
    	MessageLoop();
    
    	return 0;
    }
    
    HRESULT SetupD3D()
    {
    	if (NULL = (g_pD3D = Direct3DCreate8(D3D_SDK_VERSION)))
                   return E_FAIL;
    	
    
    	return 0;
    }
    Everything used to work fine, but for some reason VC++ 6 is hating DX8. Any ideas?

  2. #2
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    Make sure that in your compiler settings for include/lib directories that the direct X SDK directories come before the standard directories.

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    You miss d3d8.lib and/or d3dx8.lib.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Nothing to do with d3dx8.lib. That is only a "helper" library. He needs to link to d3d8.lib probably.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. synchronization object choosing
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 03-22-2008, 04:33 AM
  2. Replies: 4
    Last Post: 11-14-2006, 11:52 AM
  3. Creating a new object of a subclass problems.
    By Goombaz in forum C++ Programming
    Replies: 6
    Last Post: 01-08-2006, 08:33 AM
  4. Replies: 3
    Last Post: 12-03-2001, 01:45 PM
  5. Creating an array of object pointers
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 10-08-2001, 10:01 PM