Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when compiling example #013 on Arduino IDE 2.3.4 #240

Open
gmanoel opened this issue Dec 20, 2024 · 3 comments
Open

Error when compiling example #013 on Arduino IDE 2.3.4 #240

gmanoel opened this issue Dec 20, 2024 · 3 comments

Comments

@gmanoel
Copy link

gmanoel commented Dec 20, 2024

Hi.

I'm trying to compile example #13 for ESP32 Dev Module, without changing anything. Below are the compiled messages and errors. Would anyone be able to help?

`In file included from c:\Users\Gabriel\Documents\Arduino\libraries\ThingsBoard\src\Arduino_HTTP_Client.cpp:2:
c:\Users\Gabriel\Documents\Arduino\libraries\ThingsBoard\src\Arduino_HTTP_Client.h:46:16: error: cannot declare field 'Arduino_HTTP_Client::m_http_client' to be of abstract type 'HttpClient'
46 | HttpClient m_http_client; // Underlying HTTP client instance used to send data
| ^~~~~~~~~~~~~
In file included from c:\Users\Gabriel\Documents\Arduino\libraries\ArduinoHttpClient\src/ArduinoHttpClient.h:8,
from c:\Users\Gabriel\Documents\Arduino\libraries\ThingsBoard\src\Arduino_HTTP_Client.h:10:
c:\Users\Gabriel\Documents\Arduino\libraries\ArduinoHttpClient\src/HttpClient.h:41:7: note: because the following virtual functions are pure within 'HttpClient':
41 | class HttpClient : public Client
| ^~~~~~~~~~
In file included from C:\Users\Gabriel\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.0\cores\esp32/Arduino.h:197,
from c:\Users\Gabriel\Documents\Arduino\libraries\ArduinoHttpClient\src/HttpClient.h:8:
C:\Users\Gabriel\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.0\cores\esp32/Client.h:29:15: note: 'virtual int Client::connect(IPAddress, uint16_t, int32_t)'
29 | virtual int connect(IPAddress ip, uint16_t port, int32_t timeout) = 0;
| ^~~~~~~
C:\Users\Gabriel\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.0\cores\esp32/Client.h:31:15: note: 'virtual int Client::connect(const char*, uint16_t, int32_t)'
31 | virtual int connect(const char *host, uint16_t port, int32_t timeout) = 0;
| ^~~~~~~
c:\Users\Gabriel\Documents\Arduino\libraries\ThingsBoard\src\Arduino_MQTT_Client.cpp: In member function 'virtual bool Arduino_MQTT_Client::set_buffer_size(uint16_t, uint16_t)':
c:\Users\Gabriel\Documents\Arduino\libraries\ThingsBoard\src\Arduino_MQTT_Client.cpp:26:39: error: no matching function for call to 'PubSubClient::setBufferSize(uint16_t&, uint16_t&)'
26 | return m_mqtt_client.setBufferSize(receive_buffer_size, send_buffer_size);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from c:\Users\Gabriel\Documents\Arduino\libraries\ThingsBoard\src\Arduino_MQTT_Client.h:10,
from c:\Users\Gabriel\Documents\Arduino\libraries\ThingsBoard\src\Arduino_MQTT_Client.cpp:2:
c:\Users\Gabriel\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:142:12: note: candidate: 'boolean PubSubClient::setBufferSize(uint16_t)'
142 | boolean setBufferSize(uint16_t size);
| ^~~~~~~~~~~~~
c:\Users\Gabriel\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:142:12: note: candidate expects 1 argument, 2 provided
c:\Users\Gabriel\Documents\Arduino\libraries\ThingsBoard\src\Arduino_MQTT_Client.cpp: In member function 'virtual uint16_t Arduino_MQTT_Client::get_receive_buffer_size()':
c:\Users\Gabriel\Documents\Arduino\libraries\ThingsBoard\src\Arduino_MQTT_Client.cpp:30:26: error: 'class PubSubClient' has no member named 'getReceiveBufferSize'; did you mean 'getBufferSize'?
30 | return m_mqtt_client.getReceiveBufferSize();
| ^~~~~~~~~~~~~~~~~~~~
| getBufferSize
c:\Users\Gabriel\Documents\Arduino\libraries\ThingsBoard\src\Arduino_MQTT_Client.cpp: In member function 'virtual uint16_t Arduino_MQTT_Client::get_send_buffer_size()':
c:\Users\Gabriel\Documents\Arduino\libraries\ThingsBoard\src\Arduino_MQTT_Client.cpp:34:26: error: 'class PubSubClient' has no member named 'getSendBufferSize'; did you mean 'getBufferSize'?
34 | return m_mqtt_client.getSendBufferSize();
| ^~~~~~~~~~~~~~~~~
| getBufferSize

Using library WiFi at version 3.1.0 in folder: C:\Users\Gabriel\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.0\libraries\WiFi
Using library Networking at version 3.1.0 in folder: C:\Users\Gabriel\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.0\libraries\Network
Using library NetworkClientSecure at version 3.1.0 in folder: C:\Users\Gabriel\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.0\libraries\NetworkClientSecure
Using library ThingsBoard at version 0.15.0 in folder: C:\Users\Gabriel\Documents\Arduino\libraries\ThingsBoard
Using library ArduinoJson at version 6.21.4 in folder: C:\Users\Gabriel\Documents\Arduino\libraries\ArduinoJson
Using library PubSubClient at version 2.8 in folder: C:\Users\Gabriel\Documents\Arduino\libraries\PubSubClient
Using library Update at version 3.1.0 in folder: C:\Users\Gabriel\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.0\libraries\Update
Using library ArduinoHttpClient at version 0.6.1 in folder: C:\Users\Gabriel\Documents\Arduino\libraries\ArduinoHttpClient
exit status 1
`

@MathewHDYT
Copy link
Contributor

Can you try the fixes mentioned in this issue.

@gmanoel
Copy link
Author

gmanoel commented Dec 20, 2024

I'm sorry, but I don't know what I need to do to fix it. Can you be more specific about how to do it:

And that implementation is not done by the HttpClient causing the aformentioned compilation issues. To fix that could you go into the HttpClient and write an implementation for the int connect(const char *host, uint16_t port, int32_t timeout); method.

Another question, is this error expected even though all the library's versions are correct? It will be fixed by Thingsboard on another update?

@MathewHDYT
Copy link
Contributor

MathewHDYT commented Dec 22, 2024

First of all you need to update the library to the newest release to fix the latter errors. So upgrade to v0.15.0 .

To fix the first error, this is not an issue with this library but with the ArduinoHTTPClient. If you are using the newest version of the Arduino IDE, which you are 3.1.0 then the Client Interface has changed to include another method which needs to be implemented.

This is not done by the ArduinoHTTPClient, but because it should follow the Interface contract because it inherits from it, the aforementioned error is produced, that the implementation of the connect method with an additional timeout parameter is missing. This method is not used by this library but it needs to be implemented by ArduinoHTTPClient nevertheless.

There is also already an issue for this so I would recommend pinging on this issue so it might get more attention, so it will be fixed as soon as possible. The Pull Request that fixes it has also already been created on the library but not yet merged.

Until it is fixed for sure you can use the aforementioned workaround which is writing a simple implementation of that method in the actual ArduinoHTTPClient library code that simply does nothing so simply add this method to the class.

int connect(const char *host, uint16_t port, int32_t timeout) override {
     // Do nothing, simple stub to fix issues with interface.
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants