[Solved] Trying to extend a library class

Hi,

I'm using the EthernetUDP library from GitHub

I'd like to extend the functionality of the EthernetUDP class and tried doing it similar as described here: gusmith.wordpress.com

This is how I did it. The header file EthernetUDPExt.h:

#ifndef ethernetudpext_h
#define ethernetudpext_h

#include <EthernetUdp.h>

class EthernetUDPExt: public EthernetUDP {
  public:
    EthernetUDPExt();  // Constructor
  private:
};
#endif

The file EthernetUDPExt.cpp:

#include "EthernetUdp.h"

/* Constructor */
EthernetUDPExt::EthernetUDPExt() : EthernetUDP() {}

So far this is only my first try in extending a library class, so there's no additional method defined. I have a sketch which previously used EthernetUDP, and worked fine. But it doesn't compile when I try to use EthernetUDPExt. I get a compile error:
C:[...]\EthernetUdpExt.cpp:4:1: error: 'EthernetUDPExt' does not name a type

Can anybody tell my what I'm missing here?

TIA,

I found it. I compared my attempt with the example from gusmith.wordpress.com over and over and all the time I missed the main difference. I forgot this in my cpp file:

#include <EthernetUDPExt.h>

Christian

1 Like