问题背景

在使用VScode时发现万能头文件<bits/stdc++.h>的包含语句下出现红色波浪线,但是能正常运行。

#include <bits/stdc++.h>  

解决思路

在编译器位置创建一个对应的头文件

  • 找到编译器读取头文件的位置

  1. 在vscode中写一个能够读取的头文件,右击头文件,点击转到定义打开头文件

  2. 在vscode左侧找到“打开的编辑器”,点击“在文件资源管理器中显示”

  3. 能够发现在include目录下发现很多头文件,xxx/include,xxx路径每个人不同

  • 在include目录下创建对应的头文件

  1. 在该目录下创建一个bits文件夹,在文件夹下创建一个stdc++.h文件

  2. 如果出现权限询问,直接点同意即可;如果只允许建文件夹不能建文件,则找一个能够建文件的地方建好填入内容再粘贴进入bits目录下即可

  3. stdc++.h文件内容如下

    // C++ includes used for precompiling -*- C++ -*-
    // Copyright (C) 2003-2014 Free Software Foundation, Inc. This file is part of the GNU ISO C++ Library.  This library is free// software; you can redistribute it and/or modify it under the// terms of the GNU General Public License as published by the// Free Software Foundation; either version 3, or (at your option)// any later version.
    // This library is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the// GNU General Public License for more details.
    // Under Section 7 of GPL version 3, you are granted additional// permissions described in the GCC Runtime Library Exception, version// 3.1, as published by the Free Software Foundation.
    // You should have received a copy of the GNU General Public License and// a copy of the GCC Runtime Library Exception along with this program;// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see// <http://www.gnu.org/licenses/>.
    /** @file stdc++.h *  This is an implementation file for a precompiled header. */
    // 17.4.1.2 Headers
    // C
    #ifndef _GLIBCXX_NO_ASSERT
    #include <cassert>
    #endif
    #include <cctype>
    #include <cerrno>
    #include <cfloat>
    #include <ciso646>
    #include <climits>
    #include <clocale>
    #include <cmath>
    #include <csetjmp>
    #include <csignal>
    #include <cstdarg>
    #include <cstddef>
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <ctime>
    ​
    #if __cplusplus >= 201103L
    #include <ccomplex>
    #include <cfenv>
    #include <cinttypes>
    #include <cstdalign>
    #include <cstdbool>
    #include <cstdint>
    #include <ctgmath>
    #include <cwchar>
    #include <cwctype>
    #endif
    ​
    // C++
    #include <algorithm>
    #include <bitset>
    #include <complex>
    #include <deque>
    #include <exception>
    #include <fstream>
    #include <functional>
    #include <iomanip>
    #include <ios>
    #include <iosfwd>
    #include <iostream>
    #include <istream>
    #include <iterator>
    #include <limits>
    #include <list>
    #include <locale>
    #include <map>
    #include <memory>
    #include <new>
    #include <numeric>
    #include <ostream>
    #include <queue>
    #include <set>
    #include <sstream>
    #include <stack>
    #include <stdexcept>
    #include <streambuf>
    #include <string>
    #include <typeinfo>
    #include <utility>
    #include <valarray>
    #include <vector>
    ​
    #if __cplusplus >= 201103L
    #include <array>
    #include <atomic>
    #include <chrono>
    #include <condition_variable>
    #include <forward_list>
    #include <future>
    #include <initializer_list>
    #include <mutex>
    #include <random>
    #include <ratio>
    #include <regex>
    #include <scoped_allocator>
    #include <system_error>
    #include <thread>
    #include <tuple>
    #include <typeindex>
    #include <type_traits>
    #include <unordered_map>
    #include <unordered_set>
    #endif
    ​

万能头文件至此配置完成。

以上就是本期的内容!有其他兴趣的小伙伴欢迎留言!!

解决vscode头文件<bits/stdc++.h>报错问题相关推荐

  1. 【C++】头文件 bits/stdc++.h 是啥?

    原文地址: [C++]头文件 bits/stdc++.h 是啥? 欢迎访问我的博客:http://blog.duhbb.com/ 嘿嘿, 以后写 leetcode 的话, 本地直接就引用这个文件, 还 ...

  2. C++预编译头文件 bits/stdc++.h

    有时候会看到别人包含这样的头文件: #include "bits/stdc++.h" 这个头文件中有很多预先包含的头文件,内容如下: // C++ includes used fo ...

  3. 高级c++头文件bits/stdc++.h

    用这种方法声明头文件只需两行代码 #include<bits/stdc++.h> using namespace std; 这个头文件包含以下等等C++中包含的所有头文件: #includ ...

  4. C++万能头文件(bits/stdc++.h)

    先说一句 C++万能头文件,并不是所有场合都能用,比如说POJ. 我曾在POJ提交过程序,编译错误.就是因为用了万能头文件. 意思就是,不认识<bits/stdc++.h>. 因为,万能头 ...

  5. VS C++万能头文件bits/stdc++.h的配置

    万能头文件:#include<bits/stdc++.h> 路径:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\To ...

  6. 【环境配置】macOS的Xcode中使用C++万能头文件bits/stdc++.h

    启动终端 cd /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c ...

  7. std.h对应linux头文件,bits/stdc++.h头文件介绍(包含源代码)

    注:转自http://blog.csdn.net/charles_dong2/article/details/56909347,同为本人写的,有部分修改. 之前在一个小OJ上刷题时发现有人是这么写的: ...

  8. 解决VScode安装Babel转码器报错:无法将“cnpm“项识别为cmdlet\函数、脚本文件或可运行程序的名称的问题

    解决VScode安装Babel转码器报错:无法将"cnpm"项识别为cmdlet\函数.脚本文件或可运行程序的名称的问题 报错结果如下: 解决方案 第一步:安装npm 点我安装np ...

  9. 浅说万能头<bits/stdc++.h>

    #include<bits/stdc++.h>包含了C和C++的绝大多数头文件,像iostream.cmath.algorithm.iomanip.string之类的,这意味着我们不再需要 ...

最新文章

  1. github上删除一个仓库
  2. 恶意软件每天至少30万个变种 杀毒软件捉襟见肘 来看4种恶意软件反查杀技术...
  3. Redis知识点汇总
  4. oracle 全局临时变量,如何解析Oracle PL / SQL中的简单XML片段并将其加载到全局临时表中?...
  5. 关于service层、dao层,以及O/R Mapping之间的思考
  6. mui 解决弹出图片问题
  7. python数据分析笔记——数据加载与整理
  8. [国嵌攻略][084][信号同步编程]
  9. android手势感应预研
  10. 将Android手机打造成你的Python开发者桌面#华为云·寻找黑马程序员#
  11. 下 文库 试读_数字资源专题导览 | 科学文库简介
  12. 使用Movavi Video Editor如何做局部放大的影片特效
  13. 把DamnSmallLinux(DSL)安装到硬盘(虚拟机)并安装GCC
  14. DarkSide勒索病毒分析
  15. 2021父亲节祝福话语、海报素材大全
  16. Halcon 汉字识别
  17. 知识推理——正向链接推理
  18. 通过Git Hook关联Tapd和Commit
  19. 计算机 先进事迹范文,计算机,先进事迹范文.doc
  20. Mind+实例1——智慧农场

热门文章

  1. 云计算,大数据,人工智能相辅相成
  2. 《罗辑思维》读书笔记PPT模板
  3. 织物印花中的常见问题与解决办法
  4. win redis设置开机自启
  5. opencv实现两个视频拼接显示
  6. QT利用opengl 进行视频裁剪、拼接,4宫格,9宫格
  7. Python的ORM框架Peewee使用入门(二)
  8. 腾讯2019春招一面(电话面试)
  9. MoE(Mixture of Expert)简单research
  10. 国四摩托车ODB2接口图和豪爵铃木GSX250R ODB2接口图