LDF C++ parser trouble

Hi all,

I’m building platformio.ini file that targets two different architectures (ESP8266 and Teensy3) and need to include different sets of libraries. I’m using lib_deps and lib_ignore successfully, but the LDF C++ parser seems to be failing for me here. It is including both libraries in the build, though it should only include the first.

The code in the header file looks like this:

#if TEENSY31 == 1
#include <ILI9341_t3.h>
#else
#include <Adafruit_ILI9341.h>
#endif

and the platformio.ini flag looks like this:

build_flags = -O -D TEENSY31=1 -UUSB_SERIAL -DARDUINO_ARCH_AVR -DUSB_SERIAL_HID -DLAYOUT_US_ENGLISH -I./src

But the graph looks like this:

|-- <ILI9341_t3>
|   |-- <SPI> v1.0
...
|-- <Adafruit ILI9341> v1.0.0
|   |-- <Adafruit GFX Library> v1.1.5
|   |-- <SPI> v1.0

If I simply delete the line:

#include <Adafruit_ILI9341.h>

It builds fine.

What am I doing wrong?

Are you sure that your source code doesn’t depend on any files from “Adafruit ILI9341”? Could you create simple project to reproduce this issue?
Thanks.

I can confirm that my code does not depend on any files in “Adafruit ILI9341”.

To be clear, the issue is that when I do a TEENSY31 build, the LDF tries to build both libraries. The define works correctly (i.e. the correct file is included). When I change the code to:

#if TEENSY31 == 1
#include <ILI9341_t3.h>
#else
#endif

The Adafruit version disappears from the graph and is not built and the ILI9341_t3 version is built correctly.

I’ll try to create a trivial example.

I hope this is trivial enough: https://dl.dropboxusercontent.com/u/46266871/ldftest.zip

Let me know if you want me to open an issue on GitHub. Thanks!

Please open an issue Issues · platformio/platformio-core · GitHub

Done: LDF C++ parser error · Issue #837 · platformio/platformio-core · GitHub

Thanks!