Sign in to follow this  
VitaliBR

Strange error in my class

Recommended Posts

My class does not use any external lib, only the patterns of DirectX, but is returning a strange error (as if there were any lib):

Main.obj : error LNK2019: unresolved external symbol "public:
void __thiscall SKINNEDMESH::Load(char * const,struct IDirect3DDevice9 *)" (?
Load@SKINNEDMESH@@QAEXQADPAUIDirect3DDevice9@@@Z) referenced in function "void
__cdecl initD3D(struct HWND__ *)" (?initD3D@@YAXPAUHWND__@@@Z)



Why?

header of my class:
#ifndef SKINNED_MESH
#define SKINNED_MESH

#include <windows.h>
#include <d3dx9.h>
#include <string>
#include <vector>

struct BONE: public D3DXFRAME
{
D3DXMATRIX CombinedTransformationMatrix;
};

struct BONEMESH: public D3DXMESHCONTAINER
{
ID3DXMesh* OriginalMesh;
std::vector<D3DMATERIAL9> materials;
std::vector<IDirect3DTexture9*> textures;

DWORD NumAttributeGroups;
D3DXATTRIBUTERANGE* attributeTable;
D3DXMATRIX** boneMatrixPtrs;
D3DXMATRIX* boneOffsetMatrices;
D3DXMATRIX* currentBoneMatrices;
};

class SKINNEDMESH
{
public:
SKINNEDMESH();
~SKINNEDMESH();
void Load(char fileName[], IDirect3DDevice9 *Dev);
void Render(BONE *bone);
void SetPose(D3DXMATRIX world, ID3DXAnimationController* animControl, float time);
void SetAnimation(char name[]);
std::vector<std::string> GetAnimations();
BONE* FindBone(char name[]);

private:
void UpdateMatrices(BONE* bone, D3DXMATRIX *parentMatrix);
void SetupBoneMatrixPointers(BONE *bone);

IDirect3DDevice9 *m_pDevice;
D3DXFRAME *m_pRootBone;
ID3DXAnimationController *m_pAnimControl;
};

#endif



and main.cpp
#include <d3d9.h>
#include <d3dx9.h>
#include <windows.h>
#include <mmsystem.h>
// include the Direct3D Library files
#pragma comment (lib,"winmm.lib")
#pragma comment (lib,"d3dx9d.lib")
#pragma comment (lib,"d3d9.lib")
#pragma comment (lib,"dxguid.lib")
#pragma comment (lib,"DxErr.lib")

#include "skinnedMesh.h"

//.......

SKINNEDMESH* m_skinnedMesh;

//....

void initD3D()
{

//......

m_skinnedMesh->Load("mesh/drone.x", d3ddev);

//.....
}

Share this post


Link to post
Share on other sites
void SKINNEDMESH::Load(char * const,struct IDirect3DDevice9 *)

does not match what is in the Header file:

void Load(char fileName[], IDirect3DDevice9 *Dev);

so it is looking for a function that does not exist.

Share this post


Link to post
Share on other sites
From the error its producing it looks like you are doing this:

In your header you declare Load to be:
void Load(char fileName[], IDirect3DDevice9 *Dev);

but in the implementation you have it as:
void SKINNEDMESH::Load(char *, IDirect3DDevice9 *)

so you need to have
void Load(char fileName[], IDirect3DDevice9 *Dev);

changed to:
void Load(char* filename, IDirect3DDevice9 *Dev);

The error is saying that a symbol is missing, this usually means that you are trying to call a function that has not been declared.

In your case you are calling a member function that does not exist in the class SKINNEDMESH for the reasons above.

Hope this helps.

Share this post


Link to post
Share on other sites
Unresolved symbols most of the time means you simply haven't defined the function. Where is the Load-function defined?

edit: Never mind this; post above was edited after posting this.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this