VSCODE + EIDE 下 STM32 编程使用部分外设无法通过编译:undefined reference to ‘xxx‘

我在配置某些外设时,敲代码时,代码提示能正常找到所有外设的库

编译时提示找不到 undefined reference to 'xxx_init' ,也就是没找到stm32f10x_xxx.c

同一个目录下的stm32f10x_tim.c却可以被找到。

临时解决方案

将stm32f10x_xxx.c复制到头文件的目录下

最终解决方案

发现是 EIDE 配置的问题。编译时 EIDE 默认将一些外设的库函数排除在外了,

在项目目录的.eide\eide.json 中:

json 复制代码
{
  ...
  "targets": {
    "Debug": {
      "excludeList": [
        "hal/STM32F10x_StdPeriph_Driver/src/stm32f10x_bkp.c",
        "hal/STM32F10x_StdPeriph_Driver/src/stm32f10x_can.c",
        "hal/STM32F10x_StdPeriph_Driver/src/stm32f10x_cec.c",
        "hal/STM32F10x_StdPeriph_Driver/src/stm32f10x_crc.c",
        "hal/STM32F10x_StdPeriph_Driver/src/stm32f10x_dac.c",
        "hal/STM32F10x_StdPeriph_Driver/src/stm32f10x_dbgmcu.c",
        "hal/STM32F10x_StdPeriph_Driver/src/stm32f10x_dma.c",
        "hal/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c",
        "hal/STM32F10x_StdPeriph_Driver/src/stm32f10x_fsmc.c",
        "hal/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c",
        "hal/STM32F10x_StdPeriph_Driver/src/stm32f10x_iwdg.c",
        "hal/STM32F10x_StdPeriph_Driver/src/stm32f10x_pwr.c",
        "hal/STM32F10x_StdPeriph_Driver/src/stm32f10x_rtc.c",
        "hal/STM32F10x_StdPeriph_Driver/src/stm32f10x_sdio.c",
        "hal/STM32F10x_StdPeriph_Driver/src/stm32f10x_wwdg.c"
      ],
      ....
}

excludeList 中想要用到的库删除,再重新加载项目即可。

相关推荐
Wangshanjie_9815 分钟前
【STM32】-SPI通讯
stm32
合作小小程序员小小店19 分钟前
web网页,在线%食谱推荐系统%分析系统demo,基于vscode,uniapp,vue,java,jdk,springboot,mysql数据库
vue.js·spring boot·vscode·spring·uni-app
牧天白衣.2 小时前
快捷键——VsCode
vscode
蜕变的土豆3 小时前
Visual Studio 旧版软件下载教程
ide·visual studio
吃货界的硬件攻城狮4 小时前
【STM32 学习笔记】SPI通信协议
笔记·stm32·学习
努力的小帅4 小时前
STM32单片机_3
stm32·单片机·嵌入式硬件·学习·stm32c8t6
金玉满堂@bj7 小时前
PyCharm 中 Python 解释器的添加选项及作用
ide·python·pycharm
Do vis8247 小时前
STM32第十九天 ESP8266-01S和电脑实现串口通信(2)
stm32·单片机·嵌入式硬件
通信小小昕7 小时前
ubuntu18.04.1无法安装vscode(安装依赖无效)
ide·vscode·编辑器
书山有路勤为径~9 小时前
3 STM32单片机-delay延时驱动
stm32·单片机