Hello guys,
I am getting a compile error: "...\polygon.h(13): error C2504: 'node' : base class undefined"
#ifndef _NODE_H_
#define _NODE_H_
#include <iostream>
using namespace std;
class node
{
public:
node();
virtual ~node();
//
virtual void draw()=0;
};
#endif
---------------------
#ifndef _POLYGON_H_
#define _POLYGON_H_
#include <iostream>
#include <vector>
using namespace std;
struct Vec{
float x;
float y;
float z;
};
class polygon : public node { //derived class(from base class)
private:
float vertices;
float red,green,blue;
vector <Vec> points;
float xi,yi,zi;
public:
polygon();
~polygon();
void draw();
polygon(const polygon&);
friend istream& operator>>(istream& in, polygon& d);
//friend istream& operator >>(istream& in,shape& color,shape& ;
};
#endif
---------------------------------
#include <fstream>
#include "polygon.h"
using namespace std;
polygon :: polygon()
{
}
istream& operator>>(istream& in, polygon& d)
{
in >> d.red >> d.blue >> d.green;
in >> d.vertices;
Vec t;
for (int i=0;i<d.vertices;i++){
in >> t.x >> t.y >> t.z;
d.points.push_back(t);
}
return in;
}
---------------------------------
I have searched for it, but I was confused and I couldn't find what was wrong.
Please help me out...
Thanks,
Kostis
You don't include node.h in polygon.h, so the latter has no knowledge of the former.
After including the node.h into polygon.h I am getting some new errors:
polygon.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall node::~node(void)" (??1node@@UAE@XZ) referenced in function __unwindfunclet$??0polygon@@QAE@XZ$0
1>polygon.obj : error LNK2019: unresolved external symbol "public: __thiscall node::node(void)" (??0node@@QAE@XZ) referenced in function "public: __thiscall polygon::polygon(void)" (??0polygon@@QAE@XZ)
1>polygon.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall polygon::draw(void)" (?draw@polygon@@UAEXXZ)
1>polygon.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall polygon::~polygon(void)" (??1polygon@@UAE@XZ) referenced in function "public: virtual void * __thiscall polygon::`scalar deleting destructor'(unsigned int)" (??_Gpolygon@@UAEPAXI@Z)