VS2022不能使用<bits/stdc++.h>的解决方案
•<bits/stdc++.h>介绍
#include<bits/stdc++.h> 包含了目前 C++ 所包含的所有头文件,又称万能头文件,简直是开挂一般的存在。
你编程所需要的头文件基本上都囊括在了该万能头文件中,试想一下,将若干行头文件:
#include<iostream>
#include<cstdio>
#include<string>
#include<map>
#include<vector>
......只用一行代码 #include<bits/stdc++.h> 来代替,是不是简单粗暴!
•如何在VS2022中使用万能头
可惜,这么好的万能头,在VS2022中不能使用,难道就此放弃吗?
不,作为21世纪有思想的时代青年,这点问题怎么能难道我呢?
首先,找到你本地VS的安装目录,在VS中找到 include 文件夹,我的在该路径上:
D:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include
在 include 文件夹下创建一个 bits 文件夹,并新建一个 stdc++.h 的文件,将如下代码复制到 stdc++.h 文件中,即可在 VS2022 中使用万能头。
// C++ includes used for precompiling -*- C++ -*- // Copyright (C) 2003-2016 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设置完成后,重启 VS 即可愉悦的使用万能头了,完结撒花!
VS2022不能使用<bits/stdc++.h>的解决方案的更多相关文章
- 高级c++头文件bits/stdc++.h
用这种方法声明头文件只需两行代码 #include<bits/stdc++.h> using namespace std; 这个头文件包含以下等等C++中包含的所有头文件: #includ ...
- 2.头文件<bits/stdc++.h>
用这种方法声明头文件只需两行代码 #include<bits/stdc++.h> using namespace std; 这个头文件包含以下等等C++中包含的所有头文件: #inclu ...
- C++头文件#include<bits/stdc++.h>
一句话的事,直截了当——#include<bits/stdc++.h>包含C++的所有头文件 参考网站(点击):http://www.tuicool.com/articles/m6neUj ...
- #include<bits/stdc++.h>
在听学长讲课时看到了#include<bits/stdc++.h>这个头文件,瞬间懵逼辣,百度后了解了 #include<bits/stdc++.h>,包含了C++的所有头文件 ...
- <bits/stdc++.h>头文件介绍(包含源代码)
注:转自http://blog.csdn.net/charles_dong2/article/details/56909347,同为本人写的,有部分修改. 之前在一个小OJ上刷题时发现有人是这么写的: ...
- Visual Studio 中使用万能头文件 #include <bits/stdc++.h>
最近开始使用VS,之前用的DEV C++软件可直接使用 #include <bits/stdc++.h> ,但VS中并没有,为了使用方便,可直接在VS中添加此头文件,方法如下: 1.在安 ...
- 为VisualStudio2017添加bits/stdc++.h
在算法编程中经常有人只写一个头文件"bits/stdc++.h" 其实这个是很多头文件的集合,写了它后相当于包含了所有常用的C++头文件,可是需要注意的是并不是所有的OJ系统都支持 ...
- #include<bits/stdc++.h>的使用
#include<bits/stdc++.h>包含了C++里面所有的库函数,因此在写任何程序的时候只需要加上#include<bits/stdc++.h>即可.
- 万能头文件#include <bits/stdc++.h>
最近在做题的时候看到别人的题解发现别人都用这个 突然之间打开新世界的大门 去百度之后才知道#include <bits/stdc++.h>包含了目前所有的c++头文件 也就是说只要用#in ...
随机推荐
- 运行时异常&编译时异常
/* 异常体系: --------| Throwable 所有错误或者异常的父类 --------------| Error(错误) --------------| Exception(异常) 异常一 ...
- 注解的使用、拦截器使用、AOP切面使用
Java 自定义注解及使用场景 转载: https://www.jianshu.com/p/a7bedc771204 Java自定义注解一般使用场景为:自定义注解+拦截器或者AOP,使用自定义注解来自 ...
- 剑指Offer系列_09_用两个栈实现队列
package leetcode.sword_to_offfer.day01; import java.util.LinkedList; /** * 用两个栈实现一个队列.队列的声明如下,请实现它的两 ...
- 如何综合运用对称加密技术、非对称加密技术(公钥密码体制)和Hash函数 保证信息的保密性、完整性、可用性和不可否认性?
一.几个问题 在提出问题之前,先创建一个使用场景,发送方(甲方)要给接收方(乙方)发送投标书.大家知道,投标书都包括发送方的标的,这个标的是不能被竞标者知晓,更不能被竞标者修改的.在传输的投标书时,提 ...
- 5、架构--Nginx、搭建超级玛丽游戏
笔记 1.晨考 1.NFS共享文件步骤 - 服务端 [root@backup ~]# yum install nfs-utils rpcbind -y [root@backup ~]# mkdir / ...
- vc++调试总结
.在debug->windows下,有以下调试窗口 1)Breakpoints管理断点信息 可以新建条件断点,函数断点,以及特定地址改变断点(用于检测数据发生改变时机点) 在断点处,可以进入汇编 ...
- Keras学习:第一个例子-训练MNIST数据集
import numpy as npimport gzip import struct import keras as ks import logging from keras.layers impo ...
- MyBatis功能点二:MyBatis提供的拦截器平台
前面关于MyBatis功能点二plugin已经介绍了一些应用及其实现的底层代码,本文总结MyBatis提供的拦截器平台框架体系. 通过MyBatis功能点二:从责任链设计模式的角度理解插件实现技术 - ...
- Cesium 加载地形数据
1.注册Cesium Ion账号,注册地址:Sign In | Cesium ion 否则,加载数据会报错{code: "InvalidCredentials", message: ...
- TensorFlow 关闭日志打印
ubuntu 中打开命令行,执行如下指令 vim ~/.bashrc 进入配置文件后在文件末尾加上: export TF_CPP_MIN_LOG_LEVEL=2 保存退出,再使用下面命令使刚才修改的配 ...