c++ - Visual Studio Code 中的 C++ IntelliSense 无法识别 C++ STL
问题描述
我在我的 Linux 笔记本电脑上使用 Visual Studio Code。我刚刚写了一个像这样的简单程序main.cpp
:
#include<iostream>
int main()
{
}
昨天一切正常。今天我打开一个新文件,它说它不识别任何 STL 库。这是我将鼠标悬停在它上面时得到的:
#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (/home/john/Documents/main.cpp).C/C++(1696)
cannot open source file "iostream"C/C++(1696)
我运行一些命令来检查我的编译器和设置。这些是我的智能设置:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++17",
"configurationProvider": "go2sh.cmake-integration"
}
],
"version": 4
}
这是关于我的g++
编译器和我的clang
编译器的一些信息:
g++
john@john-GL63-8RC:~$ whereis g++
g++: /usr/bin/g++ /usr/share/man/man1/g++.1.gz
john@john-GL63-8RC:~$ g++ --version
g++ (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
clang
:
john@john-GL63-8RC:~$ whereis clang
clang: /usr/bin/clang /usr/lib/clang /usr/include/clang /usr/share/man/man1/clang.1.gz
john@john-GL63-8RC:~$ clang --version
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
另外我认为它们很旧,但我所做的只是通过 apt-get 安装如何更新它们?我该如何修复它?我没有改变任何东西,它只是开始自己发疯
解决方案
推荐阅读
- php - php 页面给出 500 错误但通过 ssh 执行
- c# - 在 C# 中将 json 文件反序列化为静态类
- mysql - 如何使用 innodb 提高表扫描的性能
- c - 将参数aa字符串传递给execvp
- ruby - 提取唯一词
- javascript - 使用 AJAX 和 ASP.NET 上传带有文本的文件
- php - Laravel - 来自支付网关后无法检索存储在会话中的数据
- android - 由于 RecyclerView,Scrollview 在 CollapsingToolbarLayout 下方滚动
- arrays - 使用 Go 进行插入排序
- angular - 来自 API 的 Angular 动态路由