前言
写文章的目的是想通过记录自己的学习过程,以便以后使用到相关的知识点可以回顾和参考。
方法
在工程的根目录下创建 .vscode 文件夹,按下“Crtl+Shift+P”打开 VSCode 的控制台,然后输入“C/C++: Edit configurations(JSON) ”,打开 C/C++编辑配置文件,会在 .vscode 目录下生成一个名为 c_cpp_properties.json 的文件,内容中的"includePath":表示头文件路径,往这个变量添加路径就可以了。例:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/home/xzj/Linux/kernel/6818/kernel/include",
"/home/xzj/Linux/kernel/6818/kernel/arch/arm/include"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
或者:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/bsp/delay",
"${workspaceFolder}/bsp/led",
"${workspaceFolder}/project"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}