arduino-libraries / ArduinoMqttClient

ArduinoMqttClient Library for Arduino
GNU Lesser General Public License v2.1
192 stars 75 forks source link

can't compile on ESP32 with mqttClient cannot be abstract type #5

Closed n3snah closed 5 years ago

n3snah commented 5 years ago

trying to get this library working on an ESP32. but each time I compile it. it fails with the following error.

Arduino: 1.8.5 (Linux), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"

temp:13: error: cannot declare variable 'mqttClient' to be of abstract type 'MqttClient'
 MqttClient mqttClient(wifiClient);
            ^
In file included from /home/laywah/Arduino/libraries/ArduinoMqttClient/src/ArduinoMqttClient.h:23:0,
                 from /home/laywah/git/arduino/temp/temp/temp.ino:3:
/home/laywah/Arduino/libraries/ArduinoMqttClient/src/MqttClient.h:35:7: note:   because the following virtual functions are pure within 'MqttClient':
 class MqttClient : public Client {
       ^
In file included from /home/laywah/.arduino15/packages/esp32/hardware/esp32/1.0.2/cores/esp32/Arduino.h:157:0,
                 from sketch/temp.ino.cpp:1:
/home/laywah/.arduino15/packages/esp32/hardware/esp32/1.0.2/cores/esp32/Client.h:31:17: note:   virtual int Client::connect(IPAddress, uint16_t, int)
     virtual int connect(IPAddress ip, uint16_t port, int timeout) =0;
                 ^
/home/laywah/.arduino15/packages/esp32/hardware/esp32/1.0.2/cores/esp32/Client.h:32:17: note:   virtual int Client::connect(const char*, uint16_t, int)
     virtual int connect(const char *host, uint16_t port, int timeout) =0;
                 ^
Multiple libraries were found for "WiFi.h"
 Used: /home/laywah/.arduino15/packages/esp32/hardware/esp32/1.0.2/libraries/WiFi
 Not used: /opt/arduino-1.8.5/libraries/WiFi
exit status 1
cannot declare variable 'mqttClient' to be of abstract type 'MqttClient'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
facchinm commented 5 years ago

The issue has been introduced by this commit (https://github.com/espressif/arduino-esp32/commit/9a9ff622166149da30dd13a81485184617c56387); ESP32 guys broke Client APIs so all standard libraries are not compiling anymore. I'm closing the issue here since it's not related with MQTTClient itself.