Thread: D3DXCreateTextureFromFile Craziness: External Errors with DIRECT X

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

    Angry D3DXCreateTextureFromFile Craziness: External Errors with DIRECT X

    So...I may be trying to do something strange; Please correct me if I am.

    First I present my error:
    error LNK2019: unresolved external symbol _D3DXCreateTextureFromFileA@12 referenced in function"public: __thiscall Texture::Texture(char const*)"



    The DIRECT X 9.0 method constructor is written as follows:

    Code:
    D3DXCreateTextureFromFile (LPDIRECT3DDEVICE9 pDevice, LPCSTR pSrcFile, LPDIRECT3DTEXTURE9 *ppDevice)
    LPDIRECT3DDEVICE9 is a pointer to the IDirect3DDevice9 interface.
    LPCSTR is a long pointer to a constant string.
    LPDIRECT3DTEXTURE9* is a pointer to a pointer to the IDirect3DTexture9 interface.

    I populated the method with the following:
    Code:
    D3DXCreateTextureFromFile(GraphicDevice::GetService()->Device(), TEXT("Panel1.png"), &tex);

    The function is contained in the constructor of my "Texture" class constructor.
    Code:
    #ifndef _TEXTURE_H_
    #define _TEXTURE_H_
    #include "graphicdevice.h"
    #include <string>
    class Texture
    {
    public:
    	Texture(LPCSTR filepath);
    	~Texture(void);
    private:
    	LPDIRECT3DTEXTURE9 Image;
    };
    #endif



    graphicdevice.h contains the headers and class needed.
    Code:
    #ifndef _GRAPHIC_DEVICE_H_
    #define _GRAPHIC_DEVICE_H_
    #include <windows.h>
    #include <windowsx.h>
    #include <d3d9.h>
    #include <d3dx9.h>
    #include "window.h"
    #include "singleton.h"
    #pragma comment (lib, "d3d9.lib")
    class GraphicDevice : public Singleton<GraphicDevice>
    {
    public:
    	GraphicDevice(Window window);
    	void Dispose();
    	void Draw();
    	D3DPRESENT_PARAMETERS DeviceInfo() {return _DeviceInfo;}
    	LPDIRECT3D9 Interface() {return _Interface;}
    	LPDIRECT3DDEVICE9 Device() {return _Device;}
    private:
    	D3DPRESENT_PARAMETERS _DeviceInfo;
    	LPDIRECT3D9 _Interface;
    	LPDIRECT3DDEVICE9 _Device;
    };
    #endif
    I am having quite a large amount of trouble finding the cause for this particular external error that is occuring in the texture.obj file....does anyone know what could be the cause for this problem?

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Usually "unresolved external" means "didn't link in the .dll". I would look there first.

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    58
    I included and attached all of the proper files, and quadruple checked - just to be sure. I feel that the error lies in the way I am passing in the Device, or in the way I am passing in the string to the function.

    Any ideas?

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    If there was a difficulty in what you pass, you would get a compile error. Yet you don't.

    MSDN says that that function resides in d3dx9.lib.

  5. #5
    Registered User
    Join Date
    Apr 2008
    Posts
    58
    Wow, good call! Thank you very much for your assistance!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. BOOL bool ? unresolved external symbol
    By xwielder in forum C Programming
    Replies: 6
    Last Post: 05-20-2008, 08:39 AM
  3. Overloaded Operator Causes Unresolved External Symbol
    By mikeman118 in forum C++ Programming
    Replies: 11
    Last Post: 03-03-2008, 04:40 PM
  4. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  5. Compiler errors
    By BellosX in forum C Programming
    Replies: 2
    Last Post: 09-21-2001, 03:24 AM

Tags for this Thread