0

I've got this class:

class Object3D
{
private:
    Scene *scene;

public:
    Transform transform;

    Object3D();
};

And this is Scene:

class Scene
{
private:
    void AddObject(Object3D* obj);

public:
    std::vector<Object3D*> Objects;
    std::vector<Mesh*> Meshes;
    unsigned int ObjectCount;

    void AddMesh(Mesh* mesh);
};

I am getting these errors on the declaration of scene:

C4430 : missing type specifier - int assumed. Note: C++ does not support default-int
C4430 : missing type specifier - int assumed. Note: C++ does not support default-int
C2143 syntax error: missing ';' before '*'
C2143 syntax error: missing ';' before '*'
C2238 : unexpected tokens before ';'
C2238 : unexpected tokens before ';'

I really don't understand why.

1201ProgramAlarm
  • 31,926
  • 7
  • 42
  • 52
Elfahor
  • 95
  • 1
  • 7
  • You're not providing enough information. What lines are being tagged? Did you include `Mesh` and `Object3D` headers? Etc. We don't magically know your project inside and out. – sweenish Mar 23 '21 at 20:21
  • Please provide a [mre] that demonstrates the issue, rather than just a few lines out of context. You've provided insufficient details. – Ken White Mar 23 '21 at 20:21
  • Did you include "scene.h" – thethiny Mar 23 '21 at 20:23

1 Answers1

1

So I found it was a circular dependency issue. Having a class Scene; at the beginning of Object.h solved it.

Elfahor
  • 95
  • 1
  • 7