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

學(xué)無(wú)先后,達(dá)者為師

網(wǎng)站首頁(yè) 編程語(yǔ)言 正文

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

作者:MElephant ? 更新時(shí)間: 2022-05-22 編程語(yǔ)言

?介紹

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

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

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

  只用一行代碼#include來(lái)代替,是不是簡(jiǎn)單粗暴!

?如何在VS2022中使用萬(wàn)能頭

  可惜,這么好的萬(wàn)能頭,在VS2022中不能使用,難道就此放棄嗎?

  不,作為21世紀(jì)有思想的時(shí)代青年,這點(diǎn)問題怎么能難道我呢?

  首先,找到你本地VS的安裝目錄,在VS中找到 include 文件夾,我的在該路徑上:

D:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include

  在 include 文件夾下創(chuàng)建一個(gè)bits 文件夾,并新建一個(gè)stdc++.h的文件,將如下代碼復(fù)制到stdc++.h 文件中,即可在 VS2022 中使用萬(wàn)能頭。

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

  設(shè)置完成后,重啟 VS 即可愉悅的使用萬(wàn)能頭了,完結(jié)撒花!

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

欄目分類
最近更新