Esto tiene un archivo
Código
#include "Conectividad.hpp" #ifndef _SOCKET_CPP #define _SOCKET_CPP class Socket{ private: Host *host; public: Receiver *receiver; Sender *sender; Conectividad *conectividad; public: Socket(Host*); }; Socket::Socket(Host*pHost){ this->host = pHost; this->receiver = new Receiver(this->host); this->sender = new Sender(this->host); this->conectividad = new Conectividad(this->host); }
Esto tiene el otro archivo
Código
El Error es este:
#ifndef _CONECTIVIDAD_CPP #define _CONECTIVIDAD_CPP class Socket; class Conectividad { private: Host *host; public: Conectividad(Host*,int); bool Bind(); bool Listen(int); Host Accept(); bool Connect(); Socket Acceptar(); }; Socket Conectividad::Accept(){ //Variables int addrlen = sizeof(sockaddr_in); // Tamaño Host HostEstructura; // Return // Acepta la Conexion HostEstructura.setSocket( accept(host->getSocket(), (sockaddr*)HostRetorno.getSockAddress(), (socklen_t*)&addrlen ) ); Socket SocketRetorno(HostEstructura); return HostEstructura; } #endif
Citar
does not name a type error in C++
Ahora si, El problema se da en el segundo archivo, el primero tiene todo bien pero cuando intento implementar el método Accept y que me retorne un Socket me tira ese error... también es porque intento llamar el constructor de Socket si haber implementado la clase completa pero es que no puedo hacer un include de Socket dentro del segundo archivo ya que me rebota, porque ya hice un #include "Conectividad.hpp" en Socket y no se porque sucede....
Alguna sugerencia??