增加Vscode引用路径

增加Vscode引用路径

问题说明

在嵌入式开发中需要经常用到库函数(SPL), Vscode需要配置引用路径才能对函数名或变量进行跳转

解决思路1

与Keil5 MDK类似, 在配置C/C++的json文件中添加所使用的头文件路径

在Vscode中进行配置

在vscode中按Ctrl+Shift+P 输入configuration, 如图选择C/C++编程配置(json)

Vscode配置

在"includePath"后面增加所要使用的头文件的路径, 如下图所示

Vscode配置

缺点

配置起来较为繁琐, 且部分函数依然无法跳转

解决思路2

在思路1的基础上, 向编写的文件中包含"stm32f10x_conf.h文件"

#include "stm32f10x_conf.h"

在stm32f10x_conf文件中有对于所有外设头文件的包含

/* Includes ------------------------------------------------------------------*/
/* Uncomment/Comment the line below to enable/disable peripheral header file inclusion */
#include "stm32f10x_adc.h"
#include "stm32f10x_bkp.h"
#include "stm32f10x_can.h"
#include "stm32f10x_cec.h"
#include "stm32f10x_crc.h"
#include "stm32f10x_dac.h"
#include "stm32f10x_dbgmcu.h"
#include "stm32f10x_dma.h"
#include "stm32f10x_exti.h"
#include "stm32f10x_flash.h"
#include "stm32f10x_fsmc.h"
#include "stm32f10x_gpio.h"
#include "stm32f10x_i2c.h"
#include "stm32f10x_iwdg.h"
#include "stm32f10x_pwr.h"
#include "stm32f10x_rcc.h"
#include "stm32f10x_rtc.h"
#include "stm32f10x_sdio.h"
#include "stm32f10x_spi.h"
#include "stm32f10x_tim.h"
#include "stm32f10x_usart.h"
#include "stm32f10x_wwdg.h"
#include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */

所以在思路1的基础上加上思路2可以较好的解决该问题

相关推荐

  1. VSCode 文件夹增加右键打开

    2024-01-29 20:48:02       30 阅读
  2. 给你的 vscode 扩展增加测试设置

    2024-01-29 20:48:02       13 阅读
  3. vscode中对 python 快速增加header 描述

    2024-01-29 20:48:02       14 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-01-29 20:48:02       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-01-29 20:48:02       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-01-29 20:48:02       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-01-29 20:48:02       20 阅读

热门阅读

  1. Anaconda 镜像清华大学开源软件镜像站

    2024-01-29 20:48:02       40 阅读
  2. 【服务器】服务器的管理口和网口

    2024-01-29 20:48:02       34 阅读
  3. 遥感影像批量裁剪(语义分割样本制作)

    2024-01-29 20:48:02       40 阅读
  4. 1930:【05NOIP普及组】陶陶摘苹果

    2024-01-29 20:48:02       36 阅读
  5. 边缘计算在电力行业的应用:挑战与机遇

    2024-01-29 20:48:02       41 阅读
  6. 【LeetCode】239. 滑动窗口最大值

    2024-01-29 20:48:02       29 阅读
  7. 力扣:130. 被围绕的区域

    2024-01-29 20:48:02       38 阅读
  8. 基于scala使用flink将kafka数据写入mysql示例

    2024-01-29 20:48:02       38 阅读