Skip to content

explicit inclusion of <Arduino.h> triggers compilation error #11488

Closed
@AndrewBCN

Description

@AndrewBCN

Hello,
I did check the open and closed issues and the closest I have found is this: #4352
but it's not the same.

I am using Ubuntu 20.10, Arduino 1.8.13 and STM32 core 2.0.0.

In some of my sketches I test for the STM32 core version with this code
#if !defined(STM32_CORE_VERSION) || (STM32_CORE_VERSION < 0x02000000)
#error "Due to API change, this sketch is compatible with STM32_CORE_VERSION >= 0x02000000"
#endif

This compiles totally fine.

However, if in my sketch I explicitly add:
#include <Arduino.h>

this triggers the compilation error in the test.

It was my understanding that the Arduino build system automatically adds the #include <Arduino.h> to the top of the generated cpp code, so that would be a double inclusion and shouldn't change anything at all, but it seems it does.

Some help to solve this conundrum would be very much appreciated.

Note that the example sketches in the U8g2/u8x8 library all explicitly add #include <Arduino.h>, that's how I stumbled upon this problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: InvalidOff topic for this repository, or a bug report determined to not actually represent a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions