在VS Code中使用独立根目录的includePath属性,可以通过以下步骤实现:
.vscode
的文件夹(如果已存在,请跳过此步骤)。.vscode
文件夹中创建一个名为c_cpp_properties.json
的文件。c_cpp_properties.json
文件中,添加以下代码:{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
"/path/to/your/include/folder"
],
"defines": [],
"macFrameworkPath": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-x64"
}
],
"version": 4
}
在上述代码中,${workspaceFolder}/**
表示将项目文件夹及其所有子文件夹添加到includePath中。/path/to/your/include/folder
表示你的自定义include文件夹的路径,你可以根据实际情况进行修改。
c_cpp_properties.json
文件。现在,你可以在VS Code中使用独立根目录的includePath属性了。