文档章节

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

LoSingSang
 LoSingSang
发布于 04/14 17:22
字数 731
阅读 317
收藏 1

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

 

本文转载自:https://blog.csdn.net/dragon60066/article/details/56529077

共有 人打赏支持
LoSingSang
粉丝 3
博文 28
码字总数 5127
作品 0
深圳
程序员
JNI实现JAVA调用C/C++开源库

一、前言 JNI(Java Native Interface)的作用是实现java调用C/C++写的方法或开源库。由于java语言自身的局限性,一些特定功能的开源库往往是没有java语言版本的,比如本人项目中需要用到DSP库...

国之利刃2013
2017/08/01
0
0
在查找预编译头时遇到意外的文件结尾。是否忘记了向源中添加“#include "StdAfx.h"”?

错误 16 error C1010: 在查找预编译头时遇到意外的文件结尾。是否忘记了向源中添加“#include "StdAfx.h"”? c:gsoapgsoap-2.8gsoapstdsoap2.cpp 18894 1 AddServer 错误原因: 在创建工程时...

微wx笑
2016/05/20
0
0
ndk编译C++问题

我在ndk上编译我的c++程序时出现如下错误: ndk/armtools/arm-linux-androideabi/include/c++/4.4.3/bits/chartraits.h:70: error: 'mbstatet' in namespace 'std' does not name a type 检查......

lucasli
2012/05/24
3.3K
5
LLVM/Clang 在Windows上的设置

由于Clang源代码的缘故,Clang在编译C++程序的时候 ,后端是MinGW,无法正常的寻找到C++ libc++ Include目录 Clang查找libc++目录 由Clang源代码 libFrontendInitHeaderSearch.cpp 文件实现,...

Force武装卫队
2012/12/17
10.6K
0
VS 错误处理

1错误: fatal error C1010: unexpected endof file while looking for precompiled header. Did you forget toadd '#include"StdAfx.h"' to your source? #include"StdAfx.h" 你把这个放在头......

ucliaohh
2016/03/03
115
0

没有更多内容

加载失败,请刷新页面

加载更多

Spark Load Data and Export Data

Load_Data_Command 一、导入数据-加载csv文件数据作为spark 临时表DataSource(不需要提前创建表,方便数据分析) 该命令将csv文件导入到临时表中,命令格式为 load data '文件路径' table [...

Avner
6分钟前
0
0
CDH5.13离线安装Spark2.3详细步骤

简介: 在我的CDH5.13集群中,默认安装的spark是1.6版本,这里需要将其升级为spark2.x版本。经查阅官方文档,发现spark1.6和2.x是可以并行安装的,也就是说可以不用删除默认的1.6版本,可以直...

hblt-j
10分钟前
0
0
Add XSS protection headers on Nginx

Add XSS protection headers on Nginx Add the following line in the http or server part of your Nginx configuration : ... # XSS Protection add_header X-Frame-Opt......

idoz
10分钟前
0
0
cmake windows 配置xp toolset

MPRO
17分钟前
0
0
day125-20181023-英语流利阅读-待学习

外卖员不要哭,打零工不容易 雪梨 2018-10-23 1.今日导读 上期我们讲到,有人认为:“零工经济”虽然没有占领全世界,但它剥夺了劳动者的合法权利,加剧了工作的不稳定性,那么“零工经济”是...

飞鱼说编程
29分钟前
9
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部