在VS中使用#include 的方法

codeforces已经有过说明。我这里只是把它翻译地更加浅显一点:
solution to include bits/stdc++.h in visual c++

By Tensor, 2 years ago, ,
This is just a method i used to make me able to include bits/stdc++.h
in visual c++.
for those had minGW installed on PC :
C:\MinGW\mingw32\lib\gcc\mingw32\4.8.1\include\c++\mingw32\bits
copy this folder and then go to this adress
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include
paste your folder. go to your visual studio project type bits you will see
the auto-complete for the library and then choose stdc++.h
for those don’t have minGW:
you should write your own header file and include all libraries in it then
go to C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include
make new folder name it “bits” and name the header file stdc++.h
then paste it in “bits” folder.
Hope this helps!
Happy coding

就是说
1.如果安装了MinGW的直接在文件夹里面找到bits这个文件夹(注意里面一定要包含stdc++.h,貌似我的版本有两个bits文件夹),把里面内容复制粘贴到vs的头文件库(一般是在c盘的安装目录)里面。
(2017.3.19修正,装VS2017时候找了好一会,已经不是在这个地方,应该是先找到VS主目录,然后往这里面找VS主要目录\VC\Tools\MSVC\14.10.25017\include)
2.如果没有安装MinGW,那么自己在vs的include文件夹里面新建一个bits文件夹,里面新建一个名叫stdc++.h的头文件,里面写你常用的头文件,这里我搬运一下stdc++.h源文件:

// C++ includes used for precompiling -*- C++ -*-  

// Copyright (C) 2003-2015 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  

你可能感兴趣的:(在VS中使用#include 的方法)