I am running platformio under vscodium, developing with the Arduino libraries.
This is a segment of code from a project I'm currently developing that should error out if none of the flags are defined.
The error is printed to the console, but compilation does not halt. It carries on, spamming the console with errors related to the code that it shouldn't even try to compile.
#if !defined(USE_DS1307) && !defined(USE_DS3231) && !defined(ESP32)
#error "ERROR: This configuration is not supported on platforms other than ESP32."
#endif
This is intended to be a cross-platform project with certain aspects of the code only compiled for specific platforms.
The compiler should only continue compiling if any of these three macros is defined, and error out if they aren't. Instead, it blindly carries on.
Is there any possible reason for this? Is it possibly some stupid setting that platformio defaults to, treating an error as a warning?
Nope. I want it to fail if ALL of those macros are undefined.
The compiler hits the #error and displays it, but continues blindly compiling.
Thanks. MH
Tst:18:4: error: #error "ERROR: This configuration is not supported on platforms other than ESP32."
# error "ERROR: This configuration is not supported on platforms other than ESP32."
^~~~~
exit status 1
#error "ERROR: This configuration is not supported on platforms other than ESP32."
Do you think it might be my build environment then?
Perhaps it's some stupid default. Does anyone know how to override it or check the settings?
This is vscodium/vscode with the platformio plugin.
The platform.ini has no extra compiler switches added from the defaults.
all i did was run the compilation not the upload button
when i use upload, it always upload, or at least run the code on the target regardless if there is an error. presumably this is not suppose to happen and i just assumed it was some setting in my environment