增加Vscode引用路徑的解決方法(2種)
問題說明
在嵌入式開發(fā)中需要經(jīng)常用到庫函數(shù)(SPL), Vscode需要配置引用路徑才能對函數(shù)名或變量進(jìn)行跳轉(zhuǎn)
解決思路1
與Keil5 MDK類似, 在配置C/C++的json文件中添加所使用的頭文件路徑
在Vscode中進(jìn)行配置
在vscode中按Ctrl+Shift+P 輸入configuration, 如圖選擇C/C++編程配置(json)
在"includePath"后面增加所要使用的頭文件的路徑, 如下圖所示
缺點(diǎn)
配置起來較為繁瑣, 且部分函數(shù)依然無法跳轉(zhuǎn)
解決思路2
在思路1的基礎(chǔ)上, 向編寫的文件中包含"stm32f10x_conf.h文件"
#include "stm32f10x_conf.h"
在stm32f10x_conf文件中有對于所有外設(shè)頭文件的包含
/* 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的基礎(chǔ)上加上思路2可以較好的解決該問題
到此這篇關(guān)于增加Vscode引用路徑的解決方法(2種)的文章就介紹到這了,更多相關(guān)增加Vscode引用路徑內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
C++編程產(chǎn)生指定范圍內(nèi)的隨機(jī)數(shù)
這篇文章主要為大家詳細(xì)介紹了C++編程產(chǎn)生指定范圍內(nèi)的隨機(jī)數(shù),文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2019-09-09C語言如何實(shí)現(xiàn)一些算法或者函數(shù)你知道嗎
這篇文章主要為大家詳細(xì)介紹了C語言實(shí)現(xiàn)一些算法或者函數(shù),文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下,希望能夠給你帶來幫助2022-03-03C/C++?Qt?運(yùn)用JSON解析庫的實(shí)例代碼
這篇文章主要介紹了C/C++?Qt?運(yùn)用JSON解析庫的相關(guān)知識,通過代碼依次解析這個json文件中的每一個參數(shù),代碼簡單易懂,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2022-01-01c++中explicit與mutable關(guān)鍵字的深入探究
這篇文章主要給大家介紹了關(guān)于c++中explicit與mutable關(guān)鍵字的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2021-05-05c++中strcpy函數(shù)在VS2015無法使用的問題
這篇文章主要介紹了c++中strcpy函數(shù)在VS2015無法使用的問題,具有一定的參考價值,有需要的可以了解一下。2016-11-11