Hiya. I'm getting this multi character constant error with a vision I guess. I did some searching prior to and couldn't find my issue exactly.
**chatgpt got me to edit the file avision_web.cpp but to no effect
/home/varg/Arduino/libraries/AVision_ESP8266/src/avision_web.cpp: In member function 'String AVision::web::_REQUEST(String)':
/home/varg/Arduino/libraries/AVision_ESP8266/src/avision_web.cpp:26:1: error: control reaches end of non-void function [-Werror=return-type]
26 | }
| ^
cc1plus: some warnings being treated as errors
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
#include <PubSubClient.h>
#include <ArduinoJson.h>
#include <AVision_ESP8266.h>
#include <sha256.h>
#include <thinx.h>
#include <THiNXLib.h>
#include <thinx_root_ca.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
const char* ssid = "";
const char* password = "";
String url = "";
const int buttonPin = D2; // GPIO2
bool buttonState = HIGH;
void setup() {
pinMode(buttonPin, INPUT_PULLUP);
Serial.begin(115200);
// Connect to Wi-Fi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
Serial.println("Connected to WiFi");
}
String AVision::web::_REQUEST(String name) {
// ... [rest of the function code]
return ""; // Add this line to ensure a value is always returned
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == LOW) { // Button is pressed
if (WiFi.status() == WL_CONNECTED) {
HTTPClient http;
WiFiClient client; // Create an instance of WiFiClient
http.begin(client, url); // Use the url variable directly
int httpCode = http.GET();
http.end();
}
delay(1000); // Debounce delay
}
}
the line referenced isnt in that .cpp file to edit as suggested. i edited a line that was almost the same... to no effect.
chatbot returns the same answer as before. edit the file.
From the library file avision_web.cpp.
The compiler is correct, in the situation where the if statement is never true, then no return statement will be executed.
16
17 String web::_REQUEST(String name)
18 {
19 for (uint8_t i = 0; i < server->args(); i++)
20 {
21 if (server->argName(i) == name)
22 {
23 return server->arg(i);
24 }
25 }
26 }
27
In reference to the "multi character constant", check your code for improper use of single quotes, a multi-character constant is where you have more than a single character enclosed in single quotes instead of double quotes. That in itself is not an error, but the situation in which you are using it may be.
The fix here is the right idea, but "" is not a "String", and I'm not sure "return" will convert it for you, so you'll probably get a new compile error.
You probably want something like:
String defResponse = "";
String web::_REQUEST(String name)
{
for (uint8_t i = 0; i < server->args(); i++)
{
if (server->argName(i) == name)
{
return server->arg(i);
}
}
return defResponse;
}