9 years, 2 months ago.

Trouble with default constructor, need help

Hello guys, the following code is a part of one header of a MQTT projekt with a Nucleo F103RB device.

class MQTTEthernet : public MQTTSocket
     EthernetInterface eth;
public:    
    MQTTEthernet()
    {   
        eth.init();                          // Use DHCP
        eth.connect();
    }

    EthernetInterface& getEth()
    {
        return eth;
    }
    
    void reconnect()
    {
        eth.connect(); 
    }    
};

Error: No default constructor exists for class "EthernetInterface" in "MQTT/MQTTEthernet.h", Line: 15, Col: 6

Thank you for your help

Philipp

Can you please edit this to use <<code>> and <</code>> so that we can tell which bits are comments and which bits are the code.

posted by Andy A 29 Sep 2016

1 Answer

9 years, 2 months ago.

Are you running this against mbed 2.0 or mbed OS 5? mbed OS 5 interface changed, the MQTT project only works against mbed 2.0...