日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

關于VS2022不能使用<bits/stdc++.h>的解決方案(萬能頭文件)_C 語言

作者:MElephant ? 更新時間: 2022-05-22 編程語言

?介紹

  #include包含了目前 C++ 所包含的所有頭文件,又稱萬能頭文件,簡直是開掛一般的存在。

  你編程所需要的頭文件基本上都囊括在了該萬能頭文件中,試想一下,將若干行頭文件:

#include
#include
#include
#include
#include
......

  只用一行代碼#include來代替,是不是簡單粗暴!

?如何在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
// .
/** @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 
#include 
// 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 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#if __cplusplus >= 201402L
#include 

  設置完成后,重啟 VS 即可愉悅的使用萬能頭了,完結撒花!

原文鏈接:https://www.cnblogs.com/hyacinthLJP/p/16026002.html

欄目分類
最近更新