pointer trouble

Started by
2 comments, last by Oni Sephiroth 16 years, 2 months ago
I'm trying to use the new command, which isn't working...I have a class and a pointer of that class type, which is then set to a new object of the class. phys_object.h

#include "Phys_Main.h"

class CPhys_Object
{
	/* This class will take in a custom file type from the engine's 
	object generator tool.  You'll pass the file name to a function
	and an object will be created by calling this class' constructor.*/
public:
	CPhys_Object();
	~CPhys_Object();
};

CPhys_Object * pPhys;
void Object_Name (unsigned char * Object_File);
and then i have.. Phys_Object.cpp

#include "Phys_Object.h"


void Object_Name( unsigned char * Object_File )
{
	pPhys = new CPhys_Object;
}
..which is where it stops working, giving me the following error: 1>Phys_Object.obj : error LNK2019: unresolved external symbol "public: __thiscall CPhys_Object::CPhys_Object(void)" (??0CPhys_Object@@QAE@XZ) referenced in function "void __cdecl Object_Name(unsigned char *)" (?Object_Name@@YAXPAE@Z) 1>fatal error LNK1120: 1 unresolved externals
Advertisement
Where is the implementation of CPhys_Object() constructor you declare it then call it, but never implement it.
You told the compiler that your class has a constructor and a destructor.
The linker is telling you that it can't find your constructor.
ah, ok, I defined the constructor, so it's working now. Thankyou.

This topic is closed to new replies.

Advertisement