我正在用VS代码编写一个简单的C项目,它只需要使用GCC编译器编译一个C文件。
我创造了一个
c_cpp_properties.json
和
tasks.json
.
我不清楚GCC编译器应该从哪里获取include目录。
当include dirs添加到
c_cpp_properties.json属性
includePath
"configurations": [
{
"name": "Win32",
"includePath": [
"C:/include/path1",
"C:/include/path2"
],...
它不起作用。
只有当我将路径作为编译器参数添加到
:
"tasks":
[
{
"label": "Compile C file",
"type": "shell",
"command": "gcc",
"args": [
"-g",
"-I",
"C:/include/path1",
"-c",
"myfile.c"
],...
GCC编译器应该从哪里获取include目录?
什么是
在里面
为了什么?
c_cpp_properties.json属性
Reference Guide
说:
-
包含路径:
如果设置文件中的“CúCpp.intelliSenseEngine”设置为“默认”,则IntelliSense将使用此路径列表搜索源文件包含的标题。这与使用-I开关传递给编译器的路径列表基本相同。如果路径以/**结尾,IntelliSense引擎将从该目录开始对include进行递归搜索。如果在安装了Visual Studio的Windows上,或者在编译器路径设置中指定了编译器,则不必在此列表中列出系统包含路径。