cancel
Showing results for 
Search instead for 
Did you mean: 

Using VL53L0X with STM32L151 MCU, library header file compilation error

poonjon93
Associate

I have a custom circuit board and below is my setup

MCU: STM32L151C8T6

Sensor: VL53L0X

IDE: Atollic

Language: C

I came to notice that I must include the VL53L0X library to use it, and I'm having trouble doing so. I have downloaded the "en.STSW-IMG005.zip" that contains the library for VL53L0X. I have included the "core" and "platform" folders into my project, but the compilation kept giving me the following error

 "fatal error: vl53l0x_api.h: No such file or directory #include "vl53l0x_api.h"

I have included the .h to my main.c but the compilation error jumps from file to file, "vl53l0x_api_core.c", "vl53l0x_api_ranging.c", etc.

3 REPLIES 3
John E KVAM
ST Employee

If the files are in your tree - and they should be, it's a matter of telling the IDE where to get them.

click on File in the upper left and then on import. Select the file and it will tell the IDE where to get the file.

After compilation, check the Build Console to insure you see the -I directory.


If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.

I have checked the build console and all the folders are in the -I directory. Everytime i hit build button the error will jump to another .c file.0690X000009YD5IQAW.png0690X000009YD5DQAW.png0690X000009YD5NQAW.png

Julien NGUYEN
ST Employee

​Hi,

The easiest way for you is to download the X-CUBE-53L0A1 (API + example code for Keil, IAR and Eclipse) from st.com here.

Generate a project for STM32L151C8T6 target using Cube-MX. Then complete the project created with Cube-MX by porting the necessary files from the example code

C:\X-CUBE-53L0A1\X-CUBE-53L0A1\X-CUBE-53L0A1\STM32CubeExpansion_VL53L0X_V1.2.0\Projects\Multi\Examples\VL53L0X\RangingWithSatellites\SW4STM32\STM32F401RE-Nucleo

Thanks,

Julien 


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.