可视化配置 VS 代码以进行 C++ 编程和开发
visual Configuring VS code for c++ programming and development
#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (C:UsersLENOVODesktopprojectshelloworldhelloworld.cpp).C/C++(1696)
cannot open source file "iostream"C/C++(1696)
每当我尝试包含或任何其他文件时,都会显示上述内容。我已经安装了MinGw并且已经设置了路径环境变量。我还在 Vs 代码中安装了 c/c++ Microsoft 扩展。我仍然不明白这里发生了什么。有人可以帮忙吗
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
vector<string> msg {"Hello", "C++", "World", "from", "VS Code", "and the C++ extension!"};
for (const string& word : msg)
{
cout << word << " ";
}
cout << endl;
}
这是我尝试运行的代码段。
请参阅此文档。 设置编译器路径我认为它会起作用
尝试在 中配置包含路径数组设置.vscodec_cpp_properties.json
.
{
"configurations": [
{
"name": "Win32",
"includePath": ["${workspaceFolder}/**"],
"defines": ["_DEBUG", "UNICODE", "_UNICODE"],
"compilerPath": "C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin\gcc.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x86"
}
],
"version": 4
}
来源:C/C++ for Visual Studio Code。配置。
它还可以帮助:
#include "stdafx.h"
相关文章:
- 有一个打印语句的函数是一种糟糕的编程实践吗
- 我是C++编程的新手,这些代码之间有什么区别,我应该使用哪一个
- 模板元编程:如何将参数包组合成新的参数包
- Qt Q串行端口未编程设备未关闭
- 模板元编程 - 尝试实现维度分析
- 我是编程新手
- C++编程从外部文本文件定义数组大小
- 了解算法的性能差异(如果以不同的编程语言实现)
- 使用 Gtkmm 以编程方式选择 Gtk::TextView 中的文本
- 如何将可变参数模板转换为多个单个模板?(C++竞争编程调试模板)
- 使用命名空间正确编程
- C++编程:运算符重载中的引用如何工作?
- Arduino 模块化编程与全局和设置
- C++ 运算符修改/元编程策略,用于不那么冗长的语法
- 在没有管理员权限的情况下,在 c++ 中以编程方式将程序添加到启动
- 如何以编程方式将音频从任何录制设备路由到任何播放设备
- 试图修复一个错误,该错误不会让我开始编程其余部分
- C++模板编程设计问题 - 根据输入文件返回不同的类型
- Frank Luna 在他的书"使用 DirectX12 进行 3D 游戏编程"的介绍中盒子示例的问题
- 如何使用可变参数模板类使用模板元编程获得最大值