Class inheratance gives problems

Hi all,

I have made some classes that extens form one base class. There are a total of three classes and are part of the same library. All files are put in the same folder under librarys.

The base class is named CommunicatorModule the two classes that inhered form the base class are CommunicatorModuleSerial and CommunicatorModuleTCP.

When i include CommunicatorModule and CommunicatorModuleTCP in a sketch then there is no problem. But When include CommunicatorModule and CommunicatorModuleSerial then i get some compiler errors that the compiler can’t find object of CommunicatorModuleTCP.

I include the libaries in the following way:

#include <CommunicationModule.h>
#include <CommunicationModuleTCPIP.h>

The above is oke!

And:

#include <CommunicationModule.h>
#include <CommunicationModuleSerial.h>

Gives the following errors (and more of the same):
C:\Users\Gebruiker\Documents\Arduino\libraries\CommunicationModule/CommunicationModuleTCPIP.h:21: error: ‘IPAddress’ has not been declared
C:\Users\Gebruiker\Documents\Arduino\libraries\CommunicationModule/CommunicationModuleTCPIP.h:38: error: ‘EthernetServer’ does not name a type

How can this be? Because in the sketch i don’t include the TCP class. Is this because they are all in the same map under libraries? If so is there a way to solve this problem?

Below is the header files of the classes.
The base class

#ifndef COMMUNICATIONMODULE_H_
#define COMMUNICATIONMODULE_H_


#include "Arduino.h"

class CommunicationModule
{
   public:

	CommunicationModule();

    void Send();
    void Recieve();
    void SendBuffer();
	void RecieveBuffer();

     // ObjectInfo struct definition
     struct ObjectInfo {
     	int32_t ObjectXCor;
     	int32_t ObjectYCor;
     	int32_t ObjectMass;
     };

     // ObjectInfo struct definition
     struct SensorDataStruct{
     	int32_t PingData;
     	int32_t IRData;
     	int32_t ForceData;
     	int32_t CompassData;
     };

     // ObjectInfo struct definition
     union PackedSend{
     	struct CommStruct{
     		ObjectInfo VisionData;
     		SensorDataStruct SensorData;
     	} CommData;
     	unsigned char bytes[28];
     }SendData;

     // ObjectInfo struct definition
     union PackedRecieve{
     	struct CommStruct{
     		ObjectInfo VisionData;
     		SensorDataStruct SensorData;
     	} CommData;
     	unsigned char bytes[28];
     }RecieveData;

   private:
     int _pin;
};

The TCPIP class:

#ifndef COMMUNICATIONMODULETCPIP_H_
#define COMMUNICATIONMODULETCPIP_H_
class CommunicationModuleTCPIP : public CommunicationModule
{
   public:

  // Code etc
};


#endif

And the serial class

#ifndef COMMUNICATIONMODULESERIAL_H_
#define COMMUNICATIONMODULESERIAL_H_


#include "CommunicationModule.h"

class CommunicationModuleSerial : public CommunicationModule
{
   public:

  // Code etc


};
#endif

Any suggestion is welcome! If i need to post code or give more info please reply ;).

A small update:

When i seperate the TCP and Serial files in seperate folders and also put in each folder the base class files then there is no problem.

Is there a way to put all files in the same folder under libary and when i do import library i only have to import the one folder?

This way i don't have duplicates of the base class files.

If i need to post code or give more info please reply

Yes, you need to post ALL of your code. Zip it up and add it as an attachment, using Additional Options.