I'm having a problem with the order of my header files...
Code:
#ifndef Sphere_H
#define Sphere_H
#include "DoubleVector.h"
#include "Object.h"
typedef struct {
DoubleVector center;
double radius;
} SphereData;
void makeSphere (double centerX, double centerY, double centerZ, double radius,
Object * result);
#endif // Sphere_H
Code:
#ifndef Object_H
#define Object_H
#include "Ray.h"
#include "Sphere.h"
typedef union {
SphereData sphereType;
} ObjectData;
typedef struct {
// Shoot fires a ray at the object and stores the t-value in t. Returns 1 on
success
int (*shoot) (ObjectData const *, Ray const *, double * t);
int (*hit) (ObjectData const *, Ray const *, double t);
} ObjectFunctions;
typedef struct {
ObjectData objData;
ObjectFunctions * objFunctions;
} Object;
#endif // Object_H
Notice how Object.h and Sphere.h depend on each other. This is creating a pretty irritating problem if I try to include either file. What I need is some kind of way to prototype my typedefs, but I don't know how to do this, any help