我正在尝试在 Visual Studio Code 中编译 C++ 文件如何使用 C/C++ 扩展并添加包含路径到配置但我收到此错误:
#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit.
cannot open source file "iostream"
我已经看到了这个问题任何解决方案都对我有用。我还记录了a video按照 Visual Studio Code 教程的步骤进行操作。这是我的代码:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World" << endl;
}
这是我的 C/C++ 设置:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\x86_64-w64-mingw32\\include"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\gcc.exe",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "${default}"
}
],
"version": 4
}
打开命令面板(ctrl + shift + P)然后搜索编辑配置,选择C/C++编辑配置(UI)。然后向下滚动,您将看到包含路径,通过在文件管理器中找到它来复制包含路径的位置,默认位置为 C:\Program Files(x86)\mingw-w64\......\ mingw32\包含。将智能感知设置为默认值。现在您已经准备好享受您的编码之旅了。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)