有时候会看到别人包含这样的头文件:

#include "bits/stdc++.h"

这个头文件中有很多预先包含的头文件,内容如下:

// C++ includes used for precompiling -*- C++ -*-// Copyright (C) 2003-2018 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 <cuchar>
#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 <codecvt>
#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#if __cplusplus >= 201402L
#include <shared_mutex>
#endif#if __cplusplus >= 201703L
#include <charconv>
#include <filesystem>
#endif

包含这个头文件后,常用的std库的内容也会包含进行。

有几个注意事项:

  • 这个头文件是gcc特有的,clang和MSVC都没有
  • 如果你在做题,可以包含这个头文件
  • 日常不推荐使用

C++预编译头文件 bits/stdc++.h相关推荐

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

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

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

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

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

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

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

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

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

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

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

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

  7. 致命错误,遇到在搜索预编译头文件时遇到意外的文件结尾

    错误:fatal error C1010: unexpected end of file while looking for precompiled header directive 解决方法: 1. ...

  8. 预编译头文件来自编译器的早期版本_Debug

    1.报错形式 用Visual Studio2010 编写C++程序,编译出现错误: 预编译头文件来自编译器的早期版本,或者预编译头为 C++ 而在 C 中使用它(或相反) 2.解决方法 3.原因分析 ...

  9. C++ 预编译头文件

    1.解决什么问题? C++ 编译器是单独,分别编译的,每个cpp文件,进行预编译(也就是对#include,define 等进行文本替换),生成编译单元.编译单元是一个自包含文件,C++编译器对编译单 ...

最新文章

  1. 高性能 Windows C++ 通用组件 VC-Logger v2.0.3 正式发布
  2. android 定义date对象,如何从Date对象设置Android Chronometer基准时间?
  3. WPF DataGrid横向显示
  4. Spring中使用@ModelAttribute注解
  5. flash与php交互,flash与PHP的交互技巧
  6. JavaScript中的基本数据类型与引用数据类型
  7. transformcontrols可以用在group上吗_电缆沟盖板可以用在水沟上吗
  8. SQL*Loader 和 Data Pump
  9. 【第三课】ANR和OOM——贪快和贪多的后果(上)
  10. LINUX编译mate-desktop/pluma-1.24.0文本编辑器
  11. c语言中cmp的用法,cMP+cplay值得一试!(附下载地址和简要使用说明)
  12. VS2017 CUDA编程学习12:CUDA流
  13. IDEA打包jar包详尽流程
  14. 启发式搜索解决八数码问题
  15. Python # 金十数据数字货币新闻爬取脚本
  16. 使用python-docx模块解析docx文档
  17. fbp是什么岗位_BP是什么职位?
  18. 浅谈MySQL Binlog
  19. poi导出excel详解
  20. VS2005 常见问题分析

热门文章

  1. CentOS7(64位)下运行IPython3出错解决办法
  2. 第二十一课.粒子滤波器
  3. WOJ 1313 - K尾相等数
  4. Nature: 人的肠道古细菌基因组集
  5. 人类或起源于古菌?真假?
  6. Nature子刊:整合宏基因组、代谢组和表型分析的的计算框架
  7. 想知道自己能不能长命百岁?窝个粑粑测个菌?
  8. R语言使用ggplot2包使用geom_density()函数绘制密度图(自定义颜色填充、线条色彩、分组、均值线)实战(density plot)
  9. R语言计算平均值的标准误差(standard error of the mean):自定义函数计算平均值的标准误差、使用plotrix包的std.error函数计算平均值的标准误差
  10. R语言进行主成分分析(PCA)、使用prcomp函数进行主成分分析:碎石图可视化(scree plot)、R通过条形图(bar plot)来可视化主成分分析的碎石图(scree plot)