I have a program with these four files as part of it.
point.h
Code:
#ifndef POINT_H
#define POINT_H
#ifndef CIRCC_H
#define CIRCC_H
#include "circ.h"
#endif
class point
{
public:
// Constructors
// Methods
protected:
// More methods and variables
};
#endif
point.cpp
Code:
#include "point.h"
// Methods
circ.h
Code:
#ifndef CIRC_H
#define CIRC_H
#ifndef POINTC_H
#define POINTC_H
#include "point.h"
#endif
class circ:public point
{
public:
// Constructors
// Methods and Variables
protected:
// More variables
};
#endif
circ.cpp
Code:
#include "circ.h"
// Methods
I get the errors
- c:\users\john\documents\visual studio 2005\projects\ogl3\ogl3\point.h(19) : error C2061: syntax error : identifier 'circ'
and
- c:\users\john\documents\visual studio 2005\projects\ogl3\ogl3\circ.h(10) : error C2504: 'point' : base class undefined
as well as some other errors similar to this. I think it probably has something to do with the fact that both the circ and point classes need to include each other, but unfortunately I don't know how to fix this problem.
Exact instructions on how to resolve this problem are the most important thing here,
but I also think the problem comes because I don't really have a good idea of what exactly including files does and how exactly all the files are parsed. I just know that if a file needs to use a certain class or method, you have to include its header file, but debugging problems with it is really difficult for me, so some explanations as to what the linker and compiler are actually doing would be nice.