0

Cannot Compile Example Code
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Cannot Compile Example Code

by SirFICO on Sun Jan 06, 2019 6:47 pm

I tried to check compile 2 example sketches from the Adafruit IO Arduino library - adafruitio_15_temp_humidity and adafruitio_IO_dashboard_creation and for both I get the following error

Arduino/Sketch/libraries/ArduinoHttpClient/src/HttpClient.h:310:50: error: return-statement with a value, in function returning 'void' [-fpermissive]
virtual void flush() { return iClient->flush(); };
^
exit status 1
Error compiling for board Adafruit Feather HUZZAH ESP8266.

So to my limited abilities it appears to be something to do with the ArduinoHttpClient library. I tried to go back to an earlier version of this library but I get the same message. Do you have any suggestions or hints as to what to do to make the sketches compile OK.

SirFICO
 
Posts: 2
Joined: Sun Jan 06, 2019 6:10 pm

Re: Cannot Compile Example Code

by SirFICO on Sun Jan 06, 2019 8:36 pm

oh yehaa, I think I may have solved this myself - perhaps I'm learning something at last.

I looked on GitHub and saw an update of 4 days ago that was not in the Arduino Library so I downloaded and replace the files in the /library/xxx directory. This resulted in a whole bunch more of errors. I then saw the ESP8266 Community board in the boards manager said 'beta' so I went back to a previous version. And now I can test verify without error. I can now go to bed a happy chappie.

SirFICO
 
Posts: 2
Joined: Sun Jan 06, 2019 6:10 pm

Re: Cannot Compile Example Code

by brubell on Mon Jan 07, 2019 10:52 am

SirFICO wrote:oh yehaa, I think I may have solved this myself - perhaps I'm learning something at last.

I looked on GitHub and saw an update of 4 days ago that was not in the Arduino Library so I downloaded and replace the files in the /library/xxx directory. This resulted in a whole bunch more of errors. I then saw the ESP8266 Community board in the boards manager said 'beta' so I went back to a previous version. And now I can test verify without error. I can now go to bed a happy chappie.


You got it - there was an update to the ESP8266 BSP which forced a beta firmware onto the general release channel.

For others looking to downgrade, follow the guide here: https://learn.adafruit.com/adafruit-io- ... roject-7-1

brubell
 
Posts: 380
Joined: Fri Jul 17, 2015 10:33 pm

Re: Cannot Compile Example Code

by Lo on Sat Jan 12, 2019 5:56 pm

Great info !!
Very usefull, I was getting desperate....

Lo
 
Posts: 11
Joined: Fri Oct 26, 2018 11:32 am

Re: Cannot Compile Example Code

by JackTheSE on Sun Feb 17, 2019 10:52 am

Probably unrelated, but I get compiler errors for adafruitio_00_publish. I have installed libraries ArduinoHttpClient 0.3.2, Adafruit Arduino 2.7.23 and Adafruin MQTT Library 0.20.3. Copied error message is :

Arduino: 1.8.8 (Windows Store 1.8.19.0) (Windows 10), Board: "Adafruit Feather HUZZAH ESP8266, 80 MHz, Flash, Disabled, 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 921600"

C:\Users\jackr\Documents\Arduino\libraries\Adafruit_IO_Arduino\src\wifi\AdafruitIO_ESP8266.cpp: In constructor 'AdafruitIO_ESP8266::AdafruitIO_ESP8266(const char*, const char*, const char*, const char*)':

C:\Users\jackr\Documents\Arduino\libraries\Adafruit_IO_Arduino\src\wifi\AdafruitIO_ESP8266.cpp:22:53: error: cannot allocate an object of abstract type 'HttpClient'

_http = new HttpClient(*_client, _host, _http_port);

^

In file included from C:\Users\jackr\Documents\Arduino\libraries\ArduinoHttpClient\src/ArduinoHttpClient.h:8:0,

from C:\Users\jackr\Documents\Arduino\libraries\Adafruit_IO_Arduino\src/AdafruitIO.h:23,

from C:\Users\jackr\Documents\Arduino\libraries\Adafruit_IO_Arduino\src\wifi\AdafruitIO_ESP8266.h:18,

from C:\Users\jackr\Documents\Arduino\libraries\Adafruit_IO_Arduino\src\wifi\AdafruitIO_ESP8266.cpp:14:

C:\Users\jackr\Documents\Arduino\libraries\ArduinoHttpClient\src/HttpClient.h:41:7: note: because the following virtual functions are pure within 'HttpClient':

class HttpClient : public Client

^

In file included from C:\Users\jackr\Documents\Arduino\libraries\ArduinoHttpClient\src/HttpClient.h:10:0,

from C:\Users\jackr\Documents\Arduino\libraries\ArduinoHttpClient\src/ArduinoHttpClient.h:8,

from C:\Users\jackr\Documents\Arduino\libraries\Adafruit_IO_Arduino\src/AdafruitIO.h:23,

from C:\Users\jackr\Documents\Arduino\libraries\Adafruit_IO_Arduino\src\wifi\AdafruitIO_ESP8266.h:18,

from C:\Users\jackr\Documents\Arduino\libraries\Adafruit_IO_Arduino\src\wifi\AdafruitIO_ESP8266.cpp:14:

C:\Users\jackr\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/Client.h:29:21: note: virtual int Client::connect(const IPAddress&, uint16_t)

virtual int connect(CONST IPAddress& ip, uint16_t port) =0;

^

C:\Users\jackr\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/Client.h:37:22: note: virtual bool Client::flush(unsigned int)

virtual bool flush(unsigned int maxWaitMs = 0) = 0;

^

C:\Users\jackr\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/Client.h:38:22: note: virtual bool Client::stop(unsigned int)

virtual bool stop(unsigned int maxWaitMs = 0) = 0;

^

Using library Adafruit_IO_Arduino at version 2.7.23 in folder: C:\Users\jackr\Documents\Arduino\libraries\Adafruit_IO_Arduino
Using library Adafruit_MQTT_Library at version 0.20.3 in folder: C:\Users\jackr\Documents\Arduino\libraries\Adafruit_MQTT_Library
Using library ArduinoHttpClient at version 0.3.2 in folder: C:\Users\jackr\Documents\Arduino\libraries\ArduinoHttpClient
Using library ESP8266WiFi at version 1.0 in folder: C:\Users\jackr\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.5.0\libraries\ESP8266WiFi
exit status 1
Error compiling for board Adafruit Feather HUZZAH ESP8266.
rror compiling for board Adafruit Feather HUZZAH ESP8266.

JackTheSE
 
Posts: 15
Joined: Wed Jan 02, 2019 8:34 pm

Re: Cannot Compile Example Code

by JackTheSE on Sun Feb 17, 2019 3:53 pm

Break-Break... I was able to fix my problem above using the suggestion in a link above to revert to an earlier. more stable Http library. All is good now. ...Jack

JackTheSE
 
Posts: 15
Joined: Wed Jan 02, 2019 8:34 pm

Please be positive and constructive with your questions and comments.