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

C++ forbits converting a string const to char #563

Open
SVR1936 opened this issue Apr 18, 2023 · 1 comment
Open

C++ forbits converting a string const to char #563

SVR1936 opened this issue Apr 18, 2023 · 1 comment

Comments

@SVR1936
Copy link

SVR1936 commented Apr 18, 2023

C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\FirebaseHttpClient_Esp8266.cpp: In member function 'virtual void FirebaseHttpClientEsp8266::begin(const string&)':
C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\FirebaseHttpClient_Esp8266.cpp:47:50: error: no matching function for call to 'begin(const char*, const char [60])'
47 | http_.begin(url.c_str(), kFirebaseFingerprint);
| ^
In file included from C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\FirebaseHttpClient_Esp8266.cpp:9:
C:\Users\saura\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:166:10: note: candidate: 'bool HTTPClient::begin(String, uint16_t, String)' (near match)
166 | bool begin(String host, uint16_t port, String uri = "/") attribute ((error("obsolete API, use ::begin(WiFiClient, host, port, uri)")));
| ^~~~~
C:\Users\saura\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:166:10: note: conversion of argument 2 would be ill-formed:
C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\FirebaseHttpClient_Esp8266.cpp:47:30: error: invalid conversion from 'const char*' to 'uint16_t' {aka 'short unsigned int'} [-fpermissive]
47 | http_.begin(url.c_str(), kFirebaseFingerprint);
| ^~~~~~~~~~~~~~~~~~~~
| |
| const char*
In file included from C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\FirebaseHttpClient_Esp8266.cpp:9:
C:\Users\saura\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:167:10: note: candidate: 'bool HTTPClient::begin(String, const uint8_t*)' (near match)
167 | bool begin(String url, const uint8_t httpsFingerprint[20]) attribute ((error("obsolete API, use ::begin(WiFiClientSecure, ...)")));
| ^~~~~
C:\Users\saura\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:167:10: note: conversion of argument 2 would be ill-formed:
C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\FirebaseHttpClient_Esp8266.cpp:47:30: error: invalid conversion from 'const char*' to 'const uint8_t*' {aka 'const unsigned char*'} [-fpermissive]
47 | http_.begin(url.c_str(), kFirebaseFingerprint);
| ^~~~~~~~~~~~~~~~~~~~
| |
| const char*
C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\FirebaseHttpClient_Esp8266.cpp: In member function 'virtual void FirebaseHttpClientEsp8266::begin(const string&, const string&)':
C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\FirebaseHttpClient_Esp8266.cpp:51:60: error: invalid conversion from 'const char*' to 'const uint8_t*' {aka 'const unsigned char*'} [-fpermissive]
51 | http_.begin(host.c_str(), kFirebasePort, path.c_str(), kFirebaseFingerprint);
| ^~~~~~~~~~~~~~~~~~~~
| |
| const char*
In file included from C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\FirebaseHttpClient_Esp8266.cpp:9:
C:\Users\saura\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.1\libraries\ESP8266HTTPClient\src/ESP8266HTTPClient.h:168:70: note: initializing argument 4 of 'bool HTTPClient::begin(String, uint16_t, String, const uint8_t*)'
168 | bool begin(String host, uint16_t port, String uri, const uint8_t httpsFingerprint[20]) attribute ((error("obsolete API, use ::begin(WiFiClientSecure, ...)")));
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\Firebase.cpp: In member function 'int FirebaseRequest::sendRequest(const string&, const string&, char*, const string&, const string&)':
C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\Firebase.cpp:78:1: error: no return statement in function returning non-void [-Werror=return-type]
78 | }
| ^
C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\Firebase.cpp: In member function 'void FirebaseStream::startStreaming(const string&, const string&, const string&)':
C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\Firebase.cpp:91:16: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
91 | analyzeError("STREAM", status, path_with_auth);
| ^~~~~~~~
cc1plus.exe: some warnings being treated as errors
C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\FirebaseArduino.cpp: In member function 'String FirebaseArduino::push(const String&, const ArduinoJson::JsonVariant&)':
C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\FirebaseArduino.cpp:65:54: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
65 | int status = req_.get()->sendRequest(host_, auth_, "POST", path.c_str(), buf);
| ^~~~~~
C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\FirebaseArduino.cpp: In member function 'void FirebaseArduino::set(const String&, const ArduinoJson::JsonVariant&)':
C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\FirebaseArduino.cpp:94:41: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
94 | req_.get()->sendRequest(host_, auth_, "PUT", path.c_str(), buf);
| ^~~~~
C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\FirebaseArduino.cpp: In member function 'void FirebaseArduino::getRequest(const String&)':
C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\FirebaseArduino.cpp:101:41: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
101 | req_.get()->sendRequest(host_, auth_, "GET", path.c_str());
| ^~~~~
C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\FirebaseArduino.cpp: In member function 'virtual void FirebaseArduino::remove(const String&)':
C:\Users\saura\OneDrive\Documents\Arduino\libraries\FirebaseArduino\src\FirebaseArduino.cpp:147:41: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
147 | req_.get()->sendRequest(host_, auth_, "DELETE", path.c_str());
| ^~~~~~~~

@TrickSumo
Copy link
Contributor

In case anyone face same problem in future, downgrading ESP8266 board and ArduinoJSON library is only option as of now (September 2023).
Steps to do same:- https://www.youtube.com/watch?v=m3Xb9GB9SI8

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