C++ STL万能头文件bits/stdc++.h

     在写C++程序之前必须要做的一个步骤就是包含各种头文件,但是随着代码量的增大这些头文件实在是记不住……而且Visual Studio又不像Java 的eclipse、IntelliJ IDEA这种可以智能补全(头发都要秃了),终于查阅资料后发现一个万能头文件——bits/stdc++.h,只要写上这个头文件,基本一切STL容器的函数都可以搞定!!

     可问题又来了……我用的编译器Visual Studio 2017里没有这个头文件怎么办,于是又有了一个新的想法。。只要将下列代码复制到文本文件,保存为stdc++.h,再放到VS2017的bits文件夹里,就没问题了:(在官网可以查找bits/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// .
/** @file stdc++.h *  This is an implementation file for a precompiled header. */
// 17.4.1.2 Headers
// C
#ifndef _GLIBCXX_NO_ASSERT
#include 
#endif
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include #if __cplusplus >= 201103L
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#endif// C++
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include #if __cplusplus >= 201103L
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#endif

(然后新建一个名为bits的文件夹,将我们上面万能头文件的定义复制到该文件。保存在bits文件目录下即可。本人目录为D:\VS2017\VC\Tools\MSVC\14.16.27023\include\bits)

 


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部