STM32 的 System Workbench 中没有此类文件错误

Posted

技术标签:

【中文标题】STM32 的 System Workbench 中没有此类文件错误【英文标题】:No such file error in System Workbench for STM32 【发布时间】:2019-07-06 22:58:24 【问题描述】:

我收到一条错误消息 fatal error: stm32l0xx_hw_conf.h: No such file or directory 即使我在同一个项目中包含了stm32l0xx_hw_conf.h。如何解决此错误?

编辑:此错误的控制台输出是:

调用:MCU GCC 编译器 /home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Debug arm-none-eabi-gcc -mcpu=cortex-m0plus -mthumb -mfloat-abi=soft -DHAL_OK -DSTM32L0 -DSTM32L071xx -DUSE_MIROMICO_FMLR -DUSE_HAL_DRIVER -DUSE_BAND_868 -DSENSOR_ENABLED -DDEBUG -I"/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/inc" -I/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc/Legacy -I"/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc" -I“/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc/Legacy” -I/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc -I/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc/Legacy -I/home/dinesh/fmlr_bitbucket/lorawan/Drivers/STM32L0xx_HAL_Driver/Inc/Legacy -I“/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc/Legacy” -I"/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc" -I../../../../../../../../Drivers/CMSIS/Device/ST/STM32L1xx/包括 -I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers /CMSIS/设备/ST/STM32L0xx/包含” -I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/BSP/FMLR" -I../../../../../../../../Drivers/STM32L1xx_HAL_Driver/Inc -我“/home/dinesh/fmlr_bitbucket/lorawan/Drivers/STM32L0xx_HAL_Driver/Inc” -I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/CMSIS/Include"-I"/home/dinesh/fmlr_bitbucket/lorawan/Middlewares/Third_Party/Lora/Crypto" -I"/home/dinesh/fmlr_bitbucket/lorawan/Middlewares/Third_Party/Lora/Mac" -I"/home/dinesh/fmlr_bitbucket/lorawan/Middlewares/Third_Party/Lora/Phy" -I"/home/dinesh/fmlr_bitbucket/lorawan/Middlewares/Third_Party/Lora/Utilities" -I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/BSP/Components/Common"-I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/BSP/Components/sts_sht_21" -I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/BSP/Components/bmp280"-I"/home/dinesh/fmlr_bitbucket/lorawan/Middlewares/Third_Party/Lora/Core" -I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/BSP/sx1272mb2das"-I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/BSP/sx1272mb2das/Phy"-Og -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -MMD -MP -MF"Projects/MultiSensorHub/src/debug.d" -MT"Projects/MultiSensorHub/src/debug.o" -o "Projects/MultiSensorHub/src /debug.o" “/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/src/debug.c” /home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Debug arm-none-eabi-gcc -mcpu=cortex-m0plus -mthumb -mfloat-abi=soft -DHAL_OK -DSTM32L0 -DSTM32L071xx -DUSE_MIROMICO_FMLR -DUSE_HAL_DRIVER -DUSE_BAND_868 -DSENSOR_ENABLED -DDEBUG -I"/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/inc" -I/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc/Legacy -I"/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc" -I“/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc/Legacy” -I/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc -I/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc/Legacy -I/home/dinesh/fmlr_bitbucket/lorawan/Drivers/STM32L0xx_HAL_Driver/Inc/Legacy -I“/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc/Legacy” -I"/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc" -I../../../../../../../../Drivers/CMSIS/Device/ST/STM32L1xx/包括 -I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers /CMSIS/设备/ST/STM32L0xx/包含” -I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/BSP/FMLR" -I../../../../../../../../Drivers/STM32L1xx_HAL_Driver/Inc -我“/home/dinesh/fmlr_bitbucket/lorawan/Drivers/STM32L0xx_HAL_Driver/Inc” -I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/CMSIS/Include"-I"/home/dinesh/fmlr_bitbucket/lorawan/Middlewares/Third_Party/Lora/Crypto" -I"/home/dinesh/fmlr_bitbucket/lorawan/Middlewares/Third_Party/Lora/Mac" -I"/home/dinesh/fmlr_bitbucket/lorawan/Middlewares/Third_Party/Lora/Phy" -I"/home/dinesh/fmlr_bitbucket/lorawan/Middlewares/Third_Party/Lora/Utilities" -I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/BSP/Components/Common"-I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/BSP/Components/sts_sht_21" -I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/BSP/Components/bmp280"-I"/home/dinesh/fmlr_bitbucket/lorawan/Middlewares/Third_Party/Lora/Core" -I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/BSP/sx1272mb2das"-I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/BSP/sx1272mb2das/Phy"-Og -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -MMD -MP -MF"Projects/MultiSensorHub/src/hw_gpio.d" -MT"Projects/MultiSensorHub/src/hw_gpio.o" -o "Projects/MultiSensorHub/src /hw_gpio.o" “/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/src/hw_gpio.c” /home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Debug arm-none-eabi-gcc -mcpu=cortex-m0plus -mthumb -mfloat-abi=soft -DHAL_OK -DSTM32L0 -DSTM32L071xx -DUSE_MIROMICO_FMLR -DUSE_HAL_DRIVER -DUSE_BAND_868 -DSENSOR_ENABLED -DDEBUG -I"/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/inc" -I/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc/Legacy -I"/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc" -I“/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc/Legacy” -I/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc -I/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc/Legacy -I/home/dinesh/fmlr_bitbucket/lorawan/Drivers/STM32L0xx_HAL_Driver/Inc/Legacy -I“/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc/Legacy” -I"/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/SW4STM32/Miromico-FMLR/Drivers/STM32L0xx_HAL_Driver/Inc" -I../../../../../../../../Drivers/CMSIS/Device/ST/STM32L1xx/包括 -I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers /CMSIS/设备/ST/STM32L0xx/包含” -I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/BSP/FMLR" -I../../../../../../../../Drivers/STM32L1xx_HAL_Driver/Inc -我“/home/dinesh/fmlr_bitbucket/lorawan/Drivers/STM32L0xx_HAL_Driver/Inc” -I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/CMSIS/Include"-I"/home/dinesh/fmlr_bitbucket/lorawan/Middlewares/Third_Party/Lora/Crypto" -I"/home/dinesh/fmlr_bitbucket/lorawan/Middlewares/Third_Party/Lora/Mac" -I"/home/dinesh/fmlr_bitbucket/lorawan/Middlewares/Third_Party/Lora/Phy" -I"/home/dinesh/fmlr_bitbucket/lorawan/Middlewares/Third_Party/Lora/Utilities" -I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/BSP/Components/Common"-I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/BSP/Components/sts_sht_21" -I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/BSP/Components/bmp280"-I"/home/dinesh/fmlr_bitbucket/lorawan/Middlewares/Third_Party/Lora/Core" -I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/BSP/sx1272mb2das"-I"/home/dinesh/fmlr_bitbucket/lorawan/Drivers/BSP/sx1272mb2das/Phy"-Og -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -MMD -MP -MF"Projects/MultiSensorHub/src/bsp.d" -MT"Projects/MultiSensorHub/src/bsp.o" -o "Projects/MultiSensorHub/src /bsp.o" “/home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/src/bsp.c” 在包含的文件中 /home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/inc/hw.h:72:0,来自 /home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/src/bsp.c:50: /home/dinesh/fmlr_bitbucket/lorawan/Projects/Multi/Applications/LoRa/MultiSensorHub/inc/hw_conf.h:123:10: 致命错误:stm32l0xx_hw_conf.h:没有这样的文件或目录#include "stm32l0xx_hw_conf.h"

【问题讨论】:

这些错误(“问题”选项卡)有时是有问题的。它们并不是真正的编译器输出,它们来自 Eclipse/CDT 模块,该模块进行静态分析并尝试在编译代码之前实时向您显示错误。它通常可以正常工作,但有时可能会失败,例如当索引器有旧数据时。尝试构建您的项目并复制粘贴您的构建控制台输出(编译器命令行和错误)。 @JacekŚlimok 我确实构建了项目,但同样的错误仍然存​​在。我也会添加控制台输出。 请包含编译器命令行。 【参考方案1】:

您需要在项目设置(如果它是托管项目)中设置包含文件的路径,如果不是,则需要设置生成文件。将文件添加到项目中不会将其添加到包含路径中。

【讨论】:

我确实通过转到属性 -> C/C++ 构建 -> 包含添加了路径。我通过文件系统选择了路径并添加了它。我仍然收到错误消息。 我怀疑您的路径或名称有错误。再检查一遍。这是一个非常容易犯的错误。如果它包含在任何汇编器中,则可能需要将其添加到汇编器选项卡下的包含 添加到 GCC 编译器包括。我也加入了汇编程序。仍然出现同样的错误。【参考方案2】:

您可能需要重新索引项目。在 Eclipse 中,您可以右键单击项目并选择 Index->​​Rebuild。

【讨论】:

没什么区别。 @NiteeshShanbog 你能在 Eclipse 项目设置中添加你的构建路径的屏幕截图吗?

以上是关于STM32 的 System Workbench 中没有此类文件错误的主要内容,如果未能解决你的问题,请参考以下文章

STM32 Cmake STM32Workbench项目

CubeMX STM32 HAL + FreeRTOS

在 IAR Workbench 上加载闪存加载程序失败

关于STM32L100xx, STM32L151xx, STM32L152xx ,STM32L162xx 的Reset

[STM32 - 001] 下载最新 IAR System 软件

system_stm32f10x.c文件了解