-1

I'm having a problem since Friday that I'm breaking my head, and searched the web, stackoverflow and nothing, The problem is that when I include the class I do not recognize the type and I do not know why it happens, and repeats everything to include everything in a separate file and then include that file in classes and nothing.

sorry my bad english!

In file included from /Volumes/Datos/Work/CLionProjects/Domino/DomEngine.cpp:5:
In file included from /Volumes/Datos/Work/CLionProjects/Domino/include/DomEngine.h:8:
In file included from /Volumes/Datos/Work/CLionProjects/Domino/include/Mesa.h:10:
/Volumes/Datos/Work/CLionProjects/Domino/include/Jugador.h:56:16: error: unknown type name 'Mesa'
    void jugar(Mesa *mesa);
               ^
In file included from /Volumes/Datos/Work/CLionProjects/Domino/Mesa.cpp:7:
In file included from /Volumes/Datos/Work/CLionProjects/Domino/include/Mesa.h:10:
/Volumes/Datos/Work/CLionProjects/Domino/include/Jugador.h:56:16: error: unknown type name 'Mesa'
    void jugar(Mesa *mesa);
               ^
In file included from /Volumes/Datos/Work/CLionProjects/Domino/main.cpp:1 error generated.
2:
In file included from /Volumes/Datos/Work/CLionProjects/Domino/include/Mesa.h:10:
/Volumes/Datos/Work/CLionProjects/Domino/include/Jugador.h:56:16: error: unknown type name 'Mesa'
    void jugar(Mesa *mesa);
               ^
make[3]: *** [CMakeFiles/Domino.dir/DomEngine.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
1 error generated.
1 error generated.
make[3]: *** [CMakeFiles/Domino.dir/main.cpp.o] Error 1
make[3]: *** [CMakeFiles/Domino.dir/Mesa.cpp.o] Error 1
In file included from /Volumes/Datos/Work/CLionProjects/Domino/Jugador.cpp:7:
In file included from /Volumes/Datos/Work/CLionProjects/Domino/include/Jugador.h:12:
/Volumes/Datos/Work/CLionProjects/Domino/include/Mesa.h:15:5: error: unknown type name 'Jugador'
    Jugador *primero, *ultimo;
    ^
/Volumes/Datos/Work/CLionProjects/Domino/include/Mesa.h:25:23: error: unknown type name 'Jugador'
    void crearJugador(Jugador * jugador);
                      ^
2 errors generated.
make[3]: *** [CMakeFiles/Domino.dir/Jugador.cpp.o] Error 1
make[2]: *** [CMakeFiles/Domino.dir/all] Error 2
make[1]: *** [CMakeFiles/Domino.dir/rule] Error 2
make: *** [Domino] Error 2

Jugador.h

#ifndef DOMINO_JUGADOR_H
#define DOMINO_JUGADOR_H

#include "config.h"
#include "Ficha.h"
#include "Equipo.h"
#include "Mesa.h"

using namespace std;

class Jugador {

private:
    string nombre;
    Jugador *siguiente;
    Jugador *anterior;
    Jugador *frente;
    Ficha *fichas[7];
    Equipo *equipo;

public:

    Jugador(const string &nombre);

    const string &getNombre() const;

    Jugador *getSiguiente() const;

    Jugador *getFrente() const;

    void setSiguiente(Jugador *siguiente);

    void setFrente(Jugador *frente);

    Jugador *getAnterior() const;

    void setAnterior(Jugador *anterior);

    void setFicha(int index, Ficha *ficha);

    void verFicha(int index);

    void verFichas();

    Equipo *getEquipo() const;

    void setEquipo(Equipo *equipo);

    void ordenarFichas();

    void jugar(Mesa *mesa);


};


#endif //DOMINO_JUGADOR_H

Please help me, this is for a final project from the university,

Thanks.

drescherjm
  • 10,365
  • 5
  • 44
  • 64
luistejadaa
  • 89
  • 11

1 Answers1

0

I think I solved the problem by deleting #include "Mesa.h" and add class Mesa;

#include "config.h"
#include "Ficha.h"
#include "Equipo.h"
class Mesa;
luistejadaa
  • 89
  • 11