-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
The extern "C"
block inside "board.h" may cause incorrect symbols to be defined and linker issues. See:
Arduino_Core_STM32/cores/arduino/board.h
Lines 8 to 22 in e07c02a
#ifdef __cplusplus | |
extern "C" { | |
#endif // __cplusplus | |
#include "analog.h" | |
#include "clock.h" | |
#include "core_callback.h" | |
#include "digital_io.h" | |
#include "hw_config.h" | |
#include "low_power.h" | |
#include "rtc.h" | |
#include "spi_com.h" | |
#include "stm32_eeprom.h" | |
#include "timer.h" | |
#include "twi.h" | |
#include "uart.h" |
For example, when I added a global function in my own "variant.cpp" file, the corresponding function declaration in "variant.h" ended up being exported as a "C" symbol, causing the linker to fail with an "undefined reference" error message.
This can potentially cause similar troubles in other places and anyway it does not seem correct: any other header file does already handle extern "C"
symbols and placing an "#include" directive inside an extern "C"
block should be avoided.
I think only the init()
function declaration in "board.h" should be made extern "C"
.