platformio-core: LDF not working correct

Configuration

Operating system: Windows 10 x64

PlatformIO Version (platformio --version): PlatformIO, version 3.5.2a8

Description of problem

I experience problems with the LDF. I hope, this issue is in the right place here.

The desired library config.h is shown in the dependency graph but using its elements leads to a compilation error (see below)

I am using this folder structure (pretty standard):

├── lib
│   ├── config
│   │   └── config.h
│   └── readme.txt
├── platformio.ini
└── src
    └── main.cpp

Steps to Reproduce

  1. Create files
  2. Paste content
  3. Build

Actual Results

[02/08/18 08:06:06] Processing nodemcuv2 (build_flags: -std=c++11; lib_deps: Blynk, PCA9685; platform: espressif8266; board: nodemcuv2; framework: arduino; lib_ldf_mode: chain+)
----------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
Platform: Espressif 8266 :: NodeMCU 1.0 (ESP-12E Module)
System: ESP8266 80MHz RAM/80KB Flash/4MB
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
Modes: Finder/chain+ Compatibility/light
Collected 29 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Blynk> v0.5.0
|-- <PCA9685>
|-- <config>
Compiling .pioenvs\nodemcuv2\src\main.o
Compiling .pioenvs\nodemcuv2\lib3d7\Blynk_ID415\utility\BlynkDebug.o
Compiling .pioenvs\nodemcuv2\lib3d7\Blynk_ID415\utility\BlynkHandlers.o
Compiling .pioenvs\nodemcuv2\lib3d7\Blynk_ID415\utility\BlynkTimer.o
src\main.cpp: In function 'void loop()':
src\main.cpp:9:20: error: 'MY_UNIQUE_CONST' was not declared in this scope
Serial.println(MY_UNIQUE_CONST);
^
*** [.pioenvs\nodemcuv2\src\main.o] Error 1
======================== [ERROR] Took 3.79 seconds ========================

Expected Results

Successful build

If problems with PlatformIO Build System:

The content of platformio.ini:

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/page/projectconf.html

[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
build_flags = -std=c++11
lib_ldf_mode = chain+
lib_deps =
    Blynk
    PCA9685

Source file to reproduce issue: main.cpp

#include <Arduino.h>
#include <config.h>

void setup() {
    Serial.begin(115200);
}

void loop() {
    Serial.println(MY_UNIQUE_CONST);
}

config.h

#ifndef config_h
#define config_h

#define MY_UNIQUE_CONST 5

#endif

Additional info

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 22 (10 by maintainers)

Most upvoted comments

Yes, please put a source code of this port to project/lib/STM32RTOS/src.

COMPATIBILITY(soft) See http://docs.platformio.org/en/latest/projectconf/section_env_library.html#lib-compat-mode

You are going to use Arduino library for STM32Cube framework. Are they compatible?