[英]Visual Studio Code C/C++ Extension doesn't set the include path for the compiler
我安装了 Visual Studio Code 的 C/C++ 扩展 ( ms-vscode.cpptools
) 并尝试编译 a.cpp 文件,但我不断收到fatal error C1034: iostream: no include path set
。
这是tasks.json
的内容:
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "C/C++: cl.exe build active file",
"command": "cl.exe",
"args": [
"/Zi",
"/EHsc",
"/Fe:",
"${fileDirname}\\${fileBasenameNoExtension}.exe",
"${file}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$msCompile"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
这是c_cpp_properties.json
的内容:
{
"configurations": [
{
"name": "Win32",
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "8.1",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64"
}
],
"version": 4
}
这是确切的 output:
> 执行任务:cl.exe /Zi /EHsc /Fe: c:\Users\User\Documents\C\cpp_workshop-cpp_ex2\main.exe c:\Users\User\Documents\C\mainpp.workshop-cpp_ex2\main.exe <
适用于 x86 的 Microsoft (R) C/C++ 优化编译器版本 19.00.24213.1 版权所有 (C) Microsoft Corporation。 版权所有。
主文件
c:\Users\User\Documents\C\cpp_workshop-cpp_ex2\main.cpp(21): 致命错误 C1034: iostream: 没有包含路径集
终端进程以退出代码终止:1
帮助我,堆栈溢出。 你是我唯一的希望!
正如Ted Lyngmo所说,我遇到了同样的问题:
使用开发人员命令提示符打开 vscode。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.