"'Class2' does not name a type; did you mean 'Class1'?"

im running into a problem, writing my arduino project

I've simplified the classes below, but when i want to compile the code i get the error "exit status 1
'Class2' does not name a type; did you mean 'Class1'?" at: "Class2 c2;"

Does anyone know how to fix this or workaround my issue?

Thanks in advance, Tello.

class Class1 {

  public :
    Class2 c2;

class Class2 {

  public :
    Class1 c1;

Besides your syntactic problems (which could probably be solved by a simple "class Class2;")
your structure is nonsensical.

A contains B which contains A ...

Ended up handling it in another way, thanks anyway!


Why don't you share the new structure that you are using now?