增加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可以较好的解决该问题

相关推荐
xskukuku2 小时前
使用VSCode配置C语言运行环境
c语言·ide·vscode
小王C语言8 小时前
vscode智能提示问题、跳转问题
ide·vscode·编辑器
郝亚军15 小时前
如何在vscode上运行python程序
ide·vscode·编辑器
Arvin.Angela15 小时前
VsCode 安装文档
ide·vscode·编辑器
CAir216 小时前
copilot配置deepseek和skills
vscode·copilot·skill·deepseek
独隅17 小时前
Visual Studio Code 和 Visual Studio 2026 两大开发工具的核心差异
java·vscode·visual studio
芋头莎莎18 小时前
window 右键菜单添加 vscode
ide·vscode·编辑器
yeflx19 小时前
vscode-server下载异常导致远程连接失败解决方法
ide·vscode·编辑器
cv魔法师19 小时前
解决vscode终端报错npm : 无法加载文件npm.ps1,因为在此系统上禁止运行脚本。
ide·vscode·npm
ABAP-張旺1 天前
ABAP:Visual Studio Code官方插件安装教程
ide·vscode·编辑器