Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/08/2012, 08:24
lucas_max2002
 
Fecha de Ingreso: agosto-2012
Mensajes: 30
Antigüedad: 11 años, 8 meses
Puntos: 3
Pregunta problema con propiedad - Clases

Hola Foro

Estoy tratando de desarrollar una pequeña aplicacion en c++ (linux) pero me encuentro con algunos problemas

Tengo dos clases, una clase se llama puerto y la otra enlace

Código C++:
Ver original
  1. #ifndef PORT_HPP
  2. #define PORT_HPP
  3.  
  4. #include "Link.hpp"
  5.  
  6. class puerto
  7. {
  8.    public:
  9.        port(.....); //constructor
  10.        ~port(.....); //destructor
  11.  
  12.    private:
  13.        int _Id;
  14.  
  15.    public:
  16.         Link** Links;
  17.         ...
  18. };
  19. #endif
  20.  
  21. ahora la clase Link
  22.  
  23. #ifndef LINK_HPP
  24. #define LINK_HPP
  25.  
  26. #include "enums.hpp"
  27.  
  28. class Link
  29. {
  30.     public:
  31.         StatusEnlace Status; //StatusEnlace es un enum
  32.  
  33.     private:
  34.             int _Id;
  35.                  ...
  36.  
  37.        public:
  38.                Enlace(......); //constructor
  39.                ~Enlace(......); //Destructor
  40.                .....
  41. };

hasta aca todo bien, ahora necesito incluir en la clase link una propiedad de tipo puerto algo asi como

Port* ParentPort;

La cuestion es que cuando coloco la referencia

#include "port.hpp"

en el archivo link.hpp me salen muchisimos errores, como si no reconociera ninguna variable de la clase port.

Alguien me puede decir que estoy haciendo mal???
Gracias

Nota: si no incluyo la propiedad ni la cabecera port.hpp, el codigo se compila bien, sin ningun warning ni error

Aca dejo los errores que me salen

Link.cpp(8): error: name followed by "::" must be a class or namespace name

Link.cpp(8): error: explicit type is missing ("int" assumed)

Link.cpp(10): error: identifier "_Id" is undefined

Link.cpp(11): error: identifier "_Id_Parent_Port" is undefined

Link.cpp(12): error: identifier "_Id_Parent_Sw" is undefined

Link.cpp(14): error: identifier "Get_Port_Id" is undefined

Link.cpp(15): warning: missing return statement at end of non-void function "Link"

Link.cpp(17): error: name followed by "::" must be a class or namespace name

Link.cpp(21): error: name followed by "::" must be a class or namespace name

Link.cpp(23): error: identifier "_Type_Link" is undefined

Link.cpp(52): error: name followed by "::" must be a class or namespace name

Link.cpp(55): error: identifier "_Id" is undefined

Link.cpp(56): error: identifier "_Id_Parent_Port" is undefined

Link.cpp(57): error: identifier "_Id_Parent_Sw" is undefined

Link.cpp(59): error: identifier "_Type_Link" is undefined

Port.cpp(14): error: name followed by "::" must be a class or namespace name

Port.cpp(14): error: explicit type is missing ("int" assumed)

Port.cpp(16): error: identifier "_Id" is undefined

Port.cpp(17): error: identifier "NbLinks" is undefined

Port.cpp(18): error: identifier "_Nb_Stages" is undefined

Port.cpp(20): error: identifier "_Id_Parent_Sw" is undefined

Port.cpp(22): error: identifier "Links" is undefined

Port.cpp(22): error: identifier "Link" is undefined

Port.cpp(22): error: expected an expression

Port.cpp(22): error: expected a ";"

Port.cpp(23): warning: missing return statement at end of non-void function "Port"

Port.cpp(25): error: name followed by "::" must be a class or namespace name

Port.cpp(29): error: name followed by "::" must be a class or namespace name

Port.cpp(31): error: identifier "_Id" is undefined

Port.cpp(31): error: identifier "NbLinks" is undefined

Port.cpp(34): error: identifier "Links" is undefined

Port.cpp(43): error: function "Get_Port_Id" has already been defined