一直使用 G++ 的万能头,感觉还是比较爽了。Mac 由于使用 clang++ 来编译,不存在万能头。用久了感觉非常不爽。

增加万能头

其实万能头就是一个头文件,我们可以自己在 Mac 中增加对应的文件即可。

include 目录

clang 编译器对应的 include 目录为:/Library/Developer/CommandLineTools/usr/include。

建立万能头

我们只需要在对应的目录下,生成 stdc++.h 即可。

cd /Library/Developer/CommandLineTools/usr/include
sudo mkdir bits
cd bits
sudo vi stdc++.h

对应的 stdc++.h 的内容如下,拷贝自 G++。

// 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 <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

这样我们就可以很开心的使用万能头了。

MBP中增加万能头 bits/stdc++.h相关推荐

  1. Xcode下使用bits/stdc++.h 头文件

    Xcode下使用bits/stdc++.h 头文件 bits/stdc++.h 头文件,"万能头文件". 这个头文件包含了所有 C++ 标准库,这样我们就不用一个一个将我们需要的头 ...

  2. VS Code #include <bits/stdc++.h> 错误

    提示: 正常情况你需要使用 MinGW g++ 编译器才可以使用 bits/stdc++.h 在其他文章中有一种解决办法是复制 bits/stdc++.h (需要新建bits文件夹)到 msvc 编译 ...

  3. Visual Studio 中使用万能头文件 #include bits/stdc++.h

    进行各种练习赛后,看题解代码时经常会看到这么一个陌生的头文件 #include <bits/stdc++.h> ,这个头文件是一个C++万能头文件,里面包含了程序比赛中所有可能用到的头文件 ...

  4. Visual Studio 中使用万能头文件 #include <bits/stdc++.h>

    Visual Studio 中使用万能头文件 #include 前言 最近开始使用VS,之前用的DEV C++软件可直接使用 #include <bits/stdc++.h> ,但VS中并 ...

  5. 在VS中使用万能头文件#include bits/stdc++.h编译错误的解决方法

    2019独角兽企业重金招聘Python工程师标准>>> codeforces已经有过说明.我这里只是把它翻译地更加浅显一点: solution to include bits/std ...

  6. 【C++】万能头文件 <bits/stdc++.h> 的用法和优缺点

    [C++]万能头文件 bits/stdc++.h 的用法和优缺点 文章目录 [C++]万能头文件 bits/stdc++.h 的用法和优缺点 一.使用方法 二.头文件的内容 三.VS 中如何使用 四. ...

  7. 超详细!关于万能头文件<bits/stdc++.h>的细节

    万能头文件引言 相信大家在C/C++中一定也遇到过这些情况: 使用系统库函数(如C++<cmath>库,C<math.h>库的开方函数double sqrt(double))和 ...

  8. VScode找不到C++万能头文件<bits/stdc++.h>解决办法

    VScode找不到C++万能头文件<bits/stdc++.h>解决办法 一.万能头文件介绍 万能头文件<bits/stdc++> 中包含了 C++中大部分头文件,在大部分做题 ...

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

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

最新文章

  1. 图论文快讯|AAAI2020图相关论文合集,涉及各个方面
  2. Android程序开发中关于设置全屏无效问题
  3. 怎么查看计算机的系统内存大小,Windows10系统怎么查看电脑内存大小
  4. arduino 土壤温湿度传感器_【雕爷学编程】Arduino动手做(70)---土壤湿度传感器...
  5. RSA的加解密过程--(转自CSDN,学习用)
  6. 3: Java虚拟机体系结构
  7. FileTracker:error FTK1011编译错误的原因和解决办法
  8. 【Elasticsearch】es 的 translog
  9. 13-Mybatis 注解开发
  10. java jframe tab_java Swing实现选项卡功能(JTabbedPane)实例代码
  11. python中索引和下标_Series下标索引、标签索引、切片索引、布尔索引
  12. 下发布可执行文件_IOS APP 发布过程中涉及相关概念
  13. 6、React脚手架
  14. deepin photoshop_体验国产操作系统深度deepin一个月,谈谈使用感受!
  15. Showwindow及参数介绍
  16. 可取性、适用性、可行性:内存计算技术的影响
  17. mysql rank_在MySQL中实现Rank高级排名函数
  18. 「Luogu2495」 [SDOI2011]消耗战 虚树
  19. PHP一码空传临时网盘源码2.0+带提取码模块
  20. 实现简单的猜数字游戏

热门文章

  1. gnuplot绘图技巧
  2. Adaboost算法详解(haar人脸检测)
  3. Keras之文本分类实现
  4. vue+elementui实现可编辑表格
  5. 反射,类加载器,动态代理
  6. TYPE-C 转OTG(USB2.0传输数据)+PD充电协议芯片 乐得瑞LDR6028/LDR6023SS
  7. 【DP】 POJ 2955 Brackets 区间DP
  8. Python教你用微信每天给女朋友说晚安
  9. 海思3559万能平台搭建:串口编程
  10. 关闭windows网络检测方法