im writing a game and I have a problem resulting "C++ unresolved externals"
** My Classes:**
Terrain.h
Class Terrain
{};
PhysicsObject.h
Class PhysicsObject
{};
Physics.h
#include PhysicsObject
Class Physics : public PhysicsObject
{
public:
Physics();
void add(PhysicsObject* o);
void remove(PhysicsObject* o);
};
RenderObject.h
Class RenderObject
{};
Render.h
#include RenderObject.h
Class Render: public RenderObject
{
public:
Render();
void add(RenderObject* o);
void remove(RenderObject* o);
};
Pixel.h
#include "PhysicsObject.h"
#include "RenderObject.h"
class pixel : public RenderObject, public PhysicsObject
{};
main.cpp
#include "Physics.h"
#include "Render.h"
#include "Terrain.h"
#include "Pixel.h"
void main()
{
Physics* physics
Render* render
Terrain* terrain
Pixel* pixel1 = new Pixel()
renderer->add(pixel1);
physics->add(pixel1);
}
I have a method in my main that will create pixels and store them in vectors inside of the render and physics. My problem is I need access to physics, terrain and render inside of the pixel so that my pixels can handle their collision and destruction on their own and remove themselves from the render and physics vectors.
Any ideas how can I achieve that as when I tried to do it im getting C++ unresolved externals when I pass the pointers to the Pixel class. Its possible that some classes are being called before they are created by complier but I don't know how to fix this.