For several month I’m working succesfully with platformio.
Today I got stuck when I wanted to stop compiling with the following statement:
#ifndef VERSION1
#error “befor compiling define ‘VERSION’ in your platformio.ini file”
#endif
The directive #error doesn’t have any effect.
Can anyone give an advise?
Thank’s, Heinz
This from a test compilation I just set up:
Building in release mode
Compiling .pio/build/uno/src/main.cpp.o
Compiling .pio/build/uno/FrameworkArduino/HardwareSerial.cpp.o
src/main.cpp:4:2: error: #error "HELLO should be defined. Compilation aborted."
#error "HELLO should be defined. Compilation aborted."
^~~~~
*** [.pio/build/uno/src/main.cpp.o] Error 1
And this is the code, it’s just the blink sketch with a #error added.
#include <Arduino.h>
#ifndef HELLO
#error "HELLO should be defined. Compilation aborted."
#endif
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
and platformio.ini
:
[env:uno]
platform = atmelavr
board = uno
framework = arduino
Seems to be working fine for me. You don’t by any chance have the variable defined somewhere do you? In the source? in platformio.ini
? in a header file?
Cheers,
Norm.
Hello Norm,
thank you for your fast reply. I tested your example on my system and it worked fine for me as well. So I’ll start the exhausting search in my project to find the reason.
Cheers, Heinz