[STM32G0] 添加vl53l1库时出现问题

[复制链接]
 楼主| 咚了个咚 发表于 2025-6-14 08:00 | 显示全部楼层 |阅读模式
用STM32 CUBE ide添加vl 53 l1库到我的项目,单片机是STM32 G 030 FX
我解压en. STSW-IMG 007到drivers/vl53l1/core and drivers/vl53l1/plattform
在编译项目后,出现错误
16:37:31 **** Build of configuration Debug for project TOF ****
make -j2 all
arm-none-eabi-gcc "../Drivers/VL53L1/platform/vl53l1_platform.c" -mcpu=cortex-m0plus -std=gnu11 -g3 -c -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/VL53L1/platform/vl53l1_platform.d" -MT"Drivers/VL53L1/platform/vl53l1_platform.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Drivers/VL53L1/platform/vl53l1_platform.o"
arm-none-eabi-gcc "../Drivers/VL53L1/core/vl53l1_api.c" -mcpu=cortex-m0plus -std=gnu11 -g3 -c -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/VL53L1/core/vl53l1_api.d" -MT"Drivers/VL53L1/core/vl53l1_api.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Drivers/VL53L1/core/vl53l1_api.o"
In file included from ../Drivers/VL53L1/platform/vl53l1_platform.c:65:0:
../Drivers/VL53L1/platform/vl53l1_platform.h:67:10: fatal error: vl53l1_ll_def.h: No such file or directory
#include "vl53l1_ll_def.h"

公羊子丹 发表于 2025-7-31 15:42 | 显示全部楼层
看报错应该是你漏加了 core/inc 目录,那个 vl53l1_ll_def.h 应该在里面,检查下头文件路径设置。
周半梅 发表于 2025-7-31 15:48 | 显示全部楼层
我之前也遇到类似问题,得手动把 VL53L1 的所有 .h 文件路径加到项目的 include path 中,自动不会识别的。
帛灿灿 发表于 2025-7-31 15:49 | 显示全部楼层
你是不是只添加了 platform 和 core 文件夹?有些头文件在 inc 或 interface 子目录下,要一并加进去。
童雨竹 发表于 2025-7-31 15:50 | 显示全部楼层
可以进 Project > Properties > C/C++ General > Paths and Symbols,把 Drivers/VL53L1/core 跟 Drivers/VL53L1/platform 都加到包含路径试试。
万图 发表于 2025-7-31 15:51 | 显示全部楼层
ST 提供的 VL53L1 驱动包结构有点混乱,我那时候是参考它例程直接复制工程结构才编过。
Wordsworth 发表于 2025-7-31 15:51 | 显示全部楼层
如果你用的是 ST 提供的 en.STSW-IMG007,建议你解压后把里面所有 .h 和 .c 文件都集中拷贝,不然路径对不上。
Bblythe 发表于 2025-7-31 15:52 | 显示全部楼层
另外也记得 vl53l1_types.h 和 vl53l1_platform_log.h 等头文件也要添加,否则编译后面还会继续报错。
Pulitzer 发表于 2025-7-31 15:53 | 显示全部楼层
STM32G030资源比较紧,VL53L1 驱动建议裁剪一下,只保留用得上的功能,否则代码体积太大。
Uriah 发表于 2025-7-31 15:54 | 显示全部楼层
可以试试先跑一下 ST 自带的 VL53L1_ContinuousRanging 示例项目,照它的路径配置搬过来比较稳。
Clyde011 发表于 2025-7-31 15:55 | 显示全部楼层
如果用 CubeIDE,确保 index 全部刷新了,有时候路径已经加了,但没重新编译 index,会误报头文件丢失。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

41

主题

50

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部

41

主题

50

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部