Hello !
I’ve just began writing some code and I stumbled upon a scope error
.
The thing is that the same code compiles without errors or warnings in Arduino IDE.
The following code is a simplified version of my own code; it’s just a means of emulating the error:
main.cpp
#include <Arduino.h>
void makeLog() {
String string = logPath(); // error: `logPath` was not declared in this scope
}
String logPath() {
String currentPath = "";
currentPath = "/logFile.txt";
return currentPath;
}
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
When attempting to build it, I have the following output:
src/main.cpp: In function 'void makeLog()':
src/main.cpp:5:27: error: 'logPath' was not declared in this scope
String string = logPath(); // error: `logPath` was not declared in this scope
^
*** [.pioenvs/esp32doit-devkit-v1/src/main.cpp.o] Error 1
platformio.ini
[env:esp32doit-devkit-v1]
platform = https://github.com/platformio/platform-espressif32.git#feature/stage
board = esp32dev
framework = arduino
board_build.flash_mode = qio
upload_port = /dev/ttyUSB0
monitor_port = /dev/ttyUSB0
monitor_speed = 115200
#libraries
#lib_deps = ESP Async WebServer