Compile error using Arduino IDE 1.8.15 with build_opt.h
Posted: Mon Aug 09, 2021 5:47 am
I am going to use 2 serial ports in my STM32F103C8 project. My development environment is Windows 10, Arduino IDE 1.8.15, Arduino_Core_STM32 2.0.0
My testing code is:
void setup() {
Serial1.begin(115200);
Serial2.begin(115200);
}
void loop() {
}
build_opt.h
-DENABLE_HWSERIAL2
I got compilation error with Arduino IDE 1.8.15 as follows:
arm-none-eabi-g++: error: #line: No such file or directory
arm-none-eabi-g++: error: 1: No such file or directory
exit status 1
Error compiling for board Generic STM32F1 series.
However when I use Arduino IDE 1.8.5 (older version) to compile the same code, the result is successful.
When I check the compilation process of Arduino IDE 1.8.15, I found the build_opt.h in build folder have a additional line at the beginning like this.
#line 1 "C:\\Users\\xxxxx\\Documents\\Arduino\\stm32-sample-codes\\hwserial-test\\build_opt.h"
-DENABLE_HWSERIAL2
Even though I manually modify the build_opt.h in build folder. I still can't build the sketch as the compiler cannot find SrcWrapper.h.
C:\\Temp\\arduino_build_300941\\sketch\\SrcWrapper.cpp:1:10: fatal error: SrcWrapper.h: No such file or directory
1 | #include <SrcWrapper.h>
| ^~~~~~~~~~~~~~
compilation terminated.
Does anybody have the same problem and is there any way to resolve it?
My testing code is:
void setup() {
Serial1.begin(115200);
Serial2.begin(115200);
}
void loop() {
}
build_opt.h
-DENABLE_HWSERIAL2
I got compilation error with Arduino IDE 1.8.15 as follows:
arm-none-eabi-g++: error: #line: No such file or directory
arm-none-eabi-g++: error: 1: No such file or directory
exit status 1
Error compiling for board Generic STM32F1 series.
However when I use Arduino IDE 1.8.5 (older version) to compile the same code, the result is successful.
When I check the compilation process of Arduino IDE 1.8.15, I found the build_opt.h in build folder have a additional line at the beginning like this.
#line 1 "C:\\Users\\xxxxx\\Documents\\Arduino\\stm32-sample-codes\\hwserial-test\\build_opt.h"
-DENABLE_HWSERIAL2
Even though I manually modify the build_opt.h in build folder. I still can't build the sketch as the compiler cannot find SrcWrapper.h.
C:\\Temp\\arduino_build_300941\\sketch\\SrcWrapper.cpp:1:10: fatal error: SrcWrapper.h: No such file or directory
1 | #include <SrcWrapper.h>
| ^~~~~~~~~~~~~~
compilation terminated.
Does anybody have the same problem and is there any way to resolve it?