Dec 17, 2009 at 5:33am UTC
hi all,
I'm doing a project and a encountered a very annoying problem. I want to define an abstract "composite3d" class and derive other classes such as "table", "chair", etc.. However, when I want to build after a successful compilation, I get the following error:
------------------------
Text1.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Composite3D::draw(void)" (?draw@Composite3D@@UAEXXZ)
Debug/Text1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
------------------------
The code is below:
==================================
class Primitive3D
{
public:
int x,y,z;
bool isSelected;
};
class Composite3D
{
public:
Primitive3D *primitiveList;
int listSize;
virtual void draw();
};
class Table : public Composite3D
{
public:
Table();
void draw();
};
Table::Table ()
{
}
void Table::draw ()
{
}
void main ()
{
}
==================================
so is there anyone that knows what this basic problem is?
Dec 17, 2009 at 5:40am UTC
You need to add an = 0;
on the end to tell the compiler you aren't actually going to define it.
Also, use: int main()
.
Dec 17, 2009 at 11:38am UTC
thanks. in fact i know this and i suppose i tried it but i didn't obviously...