我试图在Windows笔记本电脑中的vs代码中进行编译,它表示无法打开源文件“ unistd.h”“检测到#include错误。请更新您的includePath。(依此类推)”我搜索了一个小时的解决方案,但仍然无法解决。这是我尝试编译的代码。#include <unistd.h>#include <stdio.h>int main(){ int i, j, rows; printf("Enter number of rows: "); scanf("%d", &rows); for(i = 1; i <= rows; ++i) { for(j = 1; j <= i; ++j) { printf("* "); } printf("\n"); } return(0);}和这是c_cpp_properties.jason文件{"configurations": [ { "name": "Win32", "includePath": [ "${workspaceFolder}/**" ], "defines": [ "_DEBUG", "UNICODE", "_UNICODE" ], "windowsSdkVersion": "10.0.17763.0", "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe", "cStandard": "c11", "cppStandard": "c++17", "intelliSenseMode": "msvc-x64" }],"version": 4}我应该在此jason文件中添加什么以“升级includePath”? 最佳答案 您应该使用<angled> include包含unistd.h(除非您在同一目录中有自己的unistd.h)#include <unistd.h>  如果中包含头文件,则预处理器将搜索预定目录路径以查找头文件。如果头文件放在“”中,则预处理器将在与源文件相同的目录中查找头文件。关于c - 如何更新includePath。 #include检测到错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/53980563/
10-13 04:09