Fails to Build when using RangeSensor.h

Hey,

Today I ran into a problem that seems to have something to do with the PlatformIO compiler. When I try to comile this code using the mbed online IDE it work’s…

The problem is that it does not find the header RangeSensor.h even though it exists in the lib ST_INTERFACES

So here some informations:

System Information:
OS: Windows 10 Pro 1803
Processor: Intel i5-8400
RAM: 16 GB
ARCH: 64 bit

PlatformIO Core: PlatformIO, version 4.0.0a1
PlatformIO IDE: Visual Studio Code 1.6.0
Pip: pip 18.1 from c:\users\user.platformio\penv\lib\site-packages\pip (python 2.7)
VS Code: 1.30.2 (system wide)

platformio.ini

[env:nucleo_f446re]
platform = ststm32
board = nucleo_f446re
framework = mbed
lib_ldf_mode = deep+
lib_deps = https//os.mbed.com/teams/ST/code/VL53L0X/,
https//os.mbed.com/teams/ST/code/ST_INTERFACES/,
https//developer.mbed.org/teams/ST/code/X_NUCLEO_COMMON/
lib_ignore = mbed-os
build_flags = -D PIO_FRAMEWORK_MBED_RTOS_PRESENT

main.cpp

#include <mbed.h>
#include <I2C.h>
#include <VL53L0X.h>
#include <RangeSensor.h>
Serial pc(SERIAL_TX, SERIAL_RX);
int main() {
wait(10);
}

Output

> Executing task: C:\Users\user.platformio\penv\Scripts\platformio.exe run <
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Processing nucleo_f446re (framework: mbed; platform: ststm32; board: nucleo_f446re)
Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https//docs.platformio.org/page/boards/ststm32/nucleo_f446re.html
PLATFORM: ST STM32 > ST Nucleo F446RE
HARDWARE: STM32F446RET6 180MHz 128KB RAM (512KB Flash)
DEBUG: CURRENT(stlink) ON-BOARD(stlink) EXTERNAL(blackmagic, jlink)
Library Dependency Finder → http//bit.ly/configure-pio-ldf
LDF MODES: FINDER(deep+) COMPATIBILITY(soft)
Collected 46 compatible libraries
Scanning dependencies…
Dependency Graph
|-- #d25c4fa216af
| |-- <X_NUCLEO_COMMON> #21096473f63e
|-- <ST_INTERFACES> #d3c9b33b992c
|-- <X_NUCLEO_COMMON> #21096473f63e
|--
Compiling .pioenvs\nucleo_f446re\src\main.o
Compiling .pioenvs\nucleo_f446re\libc82\VL53L0X\VL53L0X.o
In file included from src\main.cpp:6:0:
.piolibdeps\VL53L0X/VL53L0X.h:46:10: fatal error: RangeSensor.h: No such file or directory

*********************************************************************
* Looking for RangeSensor.h dependency? Check our library registry!
*
* CLI > platformio lib search “header:RangeSensor.h”
* Web > https//platformio.org/lib/search?query=header:RangeSensor.h
*
*********************************************************************
#include “RangeSensor.h”
^~~~~~~~~~~~~~~
compilation terminated.
*** [.pioenvs\nucleo_f446re\src\main.o] Error 1
In file included from .piolibdeps\VL53L0X\VL53L0X.cpp:41:0:
.piolibdeps\VL53L0X\VL53L0X.h:46:10: fatal error: RangeSensor.h: No such file or directory

*********************************************************************
* Looking for RangeSensor.h dependency? Check our library registry!
*
* CLI > platformio lib search “header:RangeSensor.h”
* Web > https//platformio.org/lib/search?query=header:RangeSensor.h
*
*********************************************************************

#include “RangeSensor.h”
^~~~~~~~~~~~~~~
compilation terminated.
*** [.pioenvs\nucleo_f446re\libc82\VL53L0X\VL53L0X.o] Error 1
==================================================================================================================== [ERROR] Took 6.00 seconds ====================================================================================================================
Der Terminalprozess wurde mit folgendem Exitcode beendet: 1

I removed : from links to post it here. In the original they are contained

Well first I guess that in the platformio.ini you posted all the links have a : in the https://, but since it downloaded the libs they should be there.

Next, the library structure of ST_INTERFACES is that there are 3 subfolders and the wanted header file is in one of them. But PIO only auto-includes the top-level directory.

Thus I would suggest to manually download the libraries into the lib/ folder of the project and then add a line into the platformio.ini such as

build_flags = -I lib/ST_INTERFACES/Sensors

(together with other needed folders if they also reference header files outside their own folder).

1 Like