Skip to main content
poonjon93
Associate
June 26, 2019
Question

Using VL53L0X with STM32L151 MCU, library header file compilation error

  • June 26, 2019
  • 2 replies
  • 1296 views

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.

This topic has been closed for replies.

2 replies

John E KVAM
ST Employee
June 28, 2019

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.

poonjon93
poonjon93Author
Associate
June 29, 2019

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
August 13, 2019

​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