Strange error in my class

Started by
4 comments, last by Brother Bob 13 years, 4 months ago
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);//.....}
http://mateusvitali.wordpress.com/
Advertisement
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.
But why is this happening?

I could not understand :(

I'm doing wrong?
m_skinnedMesh->Load("mesh/drone.x", d3ddev);
http://mateusvitali.wordpress.com/
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.
Thanks friend :D

worked!
http://mateusvitali.wordpress.com/
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.

This topic is closed to new replies.

Advertisement