增加Vscode引用路徑的解決方法(2種)
問題說明
在嵌入式開發(fā)中需要經常用到庫函數(shù)(SPL), Vscode需要配置引用路徑才能對函數(shù)名或變量進行跳轉
解決思路1
與Keil5 MDK類似, 在配置C/C++的json文件中添加所使用的頭文件路徑
在Vscode中進行配置
在vscode中按Ctrl+Shift+P 輸入configuration, 如圖選擇C/C++編程配置(json)
在"includePath"后面增加所要使用的頭文件的路徑, 如下圖所示
缺點
配置起來較為繁瑣, 且部分函數(shù)依然無法跳轉
解決思路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可以較好的解決該問題
到此這篇關于增加Vscode引用路徑的解決方法(2種)的文章就介紹到這了,更多相關增加Vscode引用路徑內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
C語言如何實現(xiàn)一些算法或者函數(shù)你知道嗎
這篇文章主要為大家詳細介紹了C語言實現(xiàn)一些算法或者函數(shù),文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下,希望能夠給你帶來幫助2022-03-03c++中strcpy函數(shù)在VS2015無法使用的問題
這篇文章主要介紹了c++中strcpy函數(shù)在VS2015無法使用的問題,具有一定的參考價值,有需要的可以了解一下。2016-11-11