adafruit / Adafruit_MQTT_Library

Arduino library for MQTT support
MIT License
573 stars 291 forks source link

Issue with Adafruit_MQTT_FONA.h #44

Closed wifixcort closed 8 years ago

wifixcort commented 8 years ago

I update my Adafruit_MQTT library this morning and compile as few days ago. Now in my sketch I see this compiling error. I use SAMD21 for this!!!

cannot declare variable 'mqtt' to be of abstract type 'Adafruit_MQTT_FONA'

It referes to this line:

Adafruit_MQTT_FONA mqtt(&fona, MQTT_SERVER, AIO_SERVERPORT, MQTT_USERNAME, MQTT_PASSWORD);

Is the same code I always use, I just "update" your library. Testing if I have something wrong I try to compile your mqtt_fona example include with the library, selecting Arduino UNO board, and I got the same error.

Something helpfull could be this errors with the library and debug redefinitions:

` In file included from ~/sketchbook/libraries/Adafruit_MQTT_Library/examples/mqtt_fona/mqtt_fona.ino:23:0: ~/sketchbook/libraries/Adafruit_MQTT_Library/Adafruit_MQTT.h:45:0: warning: "DEBUG_PRINT" redefined [enabled by default]

define DEBUG_PRINT(...) {}

^ In file included from ~/sketchbook/libraries/Adafruit_FONA/Adafruit_FONA.h:22:0, from ~/sketchbook/libraries/Adafruit_MQTT_Library/examples/mqtt_fona/mqtt_fona.ino:22: ~/sketchbook/libraries/Adafruit_FONA/includes/platform/FONAPlatform.h:38:0: note: this is the location of the previous definition

define DEBUG_PRINT(...)

^ In file included from ~/sketchbook/libraries/Adafruit_MQTT_Library/examples/mqtt_fona/mqtt_fona.ino:23:0: ~/sketchbook/libraries/Adafruit_MQTT_Library/Adafruit_MQTT.h:46:0: warning: "DEBUG_PRINTLN" redefined [enabled by default]

define DEBUG_PRINTLN(...) {}

^ In file included from ~/sketchbook/libraries/Adafruit_FONA/Adafruit_FONA.h:22:0, from ~/sketchbook/libraries/Adafruit_MQTT_Library/examples/mqtt_fona/mqtt_fona.ino:22: ~/sketchbook/libraries/Adafruit_FONA/includes/platform/FONAPlatform.h:39:0: note: this is the location of the previous definition

define DEBUG_PRINTLN(...)

^ mqtt_fona:62: error: cannot declare variable 'mqtt' to be of abstract type 'Adafruit_MQTT_FONA' Adafruit_MQTT_FONA mqtt(&fona, MQTT_SERVER, AIO_SERVERPORT, MQTT_USERNAME, MQTT_PASSWORD); ^ In file included from ~/sketchbook/libraries/Adafruit_MQTT_Library/examples/mqtt_fona/mqtt_fona.ino:24:0: ~/sketchbook/libraries/Adafruit_MQTT_Library/Adafruit_MQTT_FONA.h:36:7: note: because the following virtual functions are pure within 'Adafruit_MQTT_FONA': class Adafruit_MQTT_FONA : public Adafruit_MQTT { ^ In file included from ~/sketchbook/libraries/Adafruit_MQTT_Library/examples/mqtt_fona/mqtt_fona.ino:23:0: ~/sketchbook/libraries/Adafruit_MQTT_Library/Adafruit_MQTT.h:204:20: note: virtual uint16_t Adafruit_MQTT::readPacket(uint8_t, uint8_t, int16_t) virtual uint16_t readPacket(uint8_t buffer, uint8_t maxlen, int16_t timeout) = 0; `

ladyada commented 8 years ago

try the latest commits - you need to install it manually since it will take a day for the version to get updated in the library manager note we havent tested it with samd21 it ought to work, but its not tested!

wifixcort commented 8 years ago

Thanks, apparently your las commit fix the problem!!

I experiment whit this library for a while with samd21 and it worked good for my project

wifixcort commented 8 years ago

I made a little modifications to fonaTest example for use it with samd21

https://github.com/wifixcort/samd21_examples/tree/master/SAMD21_examples/samd21_fona_test