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

相关推荐
yeziyfx6 小时前
vs code 使用Git拉取/克隆(clone)仓库项目
git·vscode
H@Z*rTE|i16 小时前
vscode 安装配置claudeCode 配置美团免费模型LongCat-Flash-Thinking-2601的每天500000token 保姆级教程
ide·vscode·编辑器
学嵌入式的小杨同学16 小时前
STM32 进阶封神之路(三十四):TFT LCD 深度全解 —— 显示原理、ILI9341 控制器、8080 并行接口与底层驱动体系
vscode·stm32·单片机·嵌入式硬件·mcu·智能硬件·嵌入式实时数据库
xyh4ck18 小时前
Claude Code for VSCode:Remote SSH 环境下的免登录问题分析
ide·vscode·ssh
@BruceYan@18 小时前
VSCode Insiders 添加 OpenAI 兼容模型
ide·vscode·编辑器·copilot·自定义模型
weifont19 小时前
太烧token了,我用Ai写了一个vscode的插件wps-editor(已开源)
人工智能·vscode·wps
2501_9151063221 小时前
不依赖 Xcode 的 iOS 编译器,kxapp 中 kxbuild 工具详解
ide·vscode·ios·cocoa·个人开发·xcode·敏捷流程
阿华田51221 小时前
基于VScode构建企业级云容器开发平台技术方案
ide·vscode·编辑器
时光之源1 天前
使用ssh用Cursor/TRAE/VSCode链接远程服务器并运行可视化程序,显示在本地机器上,全流程教学!
ide·vscode·编辑器
神の愛1 天前
VSCode报错了??
ide·vscode·编辑器