B4R Question error: control reaches end of non-void function

petr4ppc

Well-Known Member
Licensed User
Longtime User
Dear friends,

with oldest B4R I can compile my software, but with B4R 4.0, I get:

what does it mean, please? Can I secure this situation with new version B4R. ESP8266Wifi LIB I have 1.59 version.
Best regards
p4ppc
 

petr4ppc

Well-Known Member
Licensed User
Longtime User
It should work with the versions listed here: https://www.b4x.com/b4r.html
Dear friends, Mr. Erel,

I have installed last version of B4R, last version of all items from here: B4R Instalation
I am using this code rESP8266OTA.cpp :

I get same result, same error as I describe above.:
Is here some new OTA lib?

Best regards
p4ppc
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Could it be that your switch statements fail to match, and the code drops through without a return statement.

B4X:
B4RString* B4RESP8266OTA::HTTPUpdate(B4RString* server, bool reboot) {
WiFiClient client;
String s;
ESPhttpUpdate.rebootOnUpdate(reboot);
t_httpUpdate_return ret = ESPhttpUpdate.update(client, server->data);
switch(ret) {
case HTTP_UPDATE_FAILED:
s = String(ESPhttpUpdate.getLastError())+" "+ESPhttpUpdate.getLastErrorString().c_str();
return StringToB4R(&s);
break;
case HTTP_UPDATE_OK:
s = "success";
return StringToB4R(&s);
break;
}
return StringToB4R("ERROR");  // incase the switch doesn't match anything.
}

Or simply add a default: to the switch statement.
 
Upvote 0

petr4ppc

Well-Known Member
Licensed User
Longtime User
Dear Daestrum,

thank you for your answer. I got same result, "rHttpUtils2\Objects\src\rESP8266OTA" :
I am using this code in rESP8266OTA.cpp:
Please very much for help,
best regards
p4ppc
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Now your error looks like a missing header file - the one that contains WiFiClient

you probably need to add

c++:
#include "WiFiClient.h"
 
Last edited:
Upvote 0

petr4ppc

Well-Known Member
Licensed User
Longtime User
Dear Daestrum,

same situation:
My rESP8266OTA.cpp code:

------------------------------
Errors:

\rHttpUtils2\Objects\src\rESP8266OTA.cpp: In member function 'B4R::B4RString* B4R::B4RESP8266OTA::HTTPUpdate2(B4R::B4RString*, int, B4R::B4RString*, bool)':



Please for help, with older B4A (3.90) is compilation OK,
best regards
p4ppc
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…