增加Vscode引用路径

增加Vscode引用路径

增加Vscode引用路径

问题说明

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

解决思路1

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

在Vscode中进行配置

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

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

缺点

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

解决思路2

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

c 复制代码
#include "stm32f10x_conf.h"

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

c 复制代码
/* 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可以较好的解决该问题

相关推荐
你疯了抱抱我4 小时前
【Mac】vscode 配置 GD32E230CXXX 开发环境
ide·vscode·macos·嵌入式
rosemary51213 小时前
Windows vscode Claude Code + DeepSeek V4
ide·windows·vscode·claude code·deepseek-v4-pro
Irene199115 小时前
在 VSCode WSL 中安装 Docker 插件(Docker 插件连接 WSL)
vscode·docker
乐于分享的阿乐15 小时前
(二)VSCode搭建python环境(详细图文保姆级教程)
ide·vscode·python
带娃的IT创业者16 小时前
1-Click GitHub Token Stealing:深入解析 VSCode 中的惊险漏洞
ide·vscode·github·安全漏洞·github token·1-click
小铁-Android1 天前
Visual Studio Code创建Flutter项目时包名组织名更改
vscode·flutter
2501_915106322 天前
iOS开发工具有哪些?iOS 开发每个阶段的实用工具
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程
OliverH-yishuihan2 天前
【保姆级教程】Win11 下从零部署 Claude Code:本地环境配置 + VSCode 可视化界面全流程指南
ide·vscode·编辑器
IOT.FIVE.NO.12 天前
[多agent工作]Codex+claudecode+vscode+copilot 自定义deepseek api加全套安装agent工作流程
ide·vscode·copilot
梦想的颜色2 天前
Docker 入门指南:从零开始掌握容器化技术
运维·服务器·vscode·python·算法·docker·云原生