C++萬(wàn)能庫(kù)頭文件在vs中的安裝步驟(圖文)
前言
C++萬(wàn)能庫(kù)頭文件在vs2019中的安裝
一、C++萬(wàn)能庫(kù)是什么?
1、C++萬(wàn)能庫(kù)的定義:簡(jiǎn)而言之,就是一條語(yǔ)句代替了多條語(yǔ)句,包含了目前c++所包含的所有頭文件
2、C++萬(wàn)能庫(kù)的寫(xiě)法:#include <bits/stdc++.h>
二、C++萬(wàn)能庫(kù)包含的內(nèi)容:
如下是bits/stdc++.h所包含的C++所有庫(kù)函數(shù)頭文件:
#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
三、如何導(dǎo)入C++萬(wàn)能庫(kù)到vs2019中:
1、首先:在桌面上新建一個(gè)文本文件;
其次:將(二)中的代碼拷貝進(jìn)入文本文件,保存并退出;
最后重命名為:stdc++.h

2、找到vs在電腦中的文件位置:找到VC下include文件夾
本機(jī)路徑D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include

3、在include文件夾中新建文件夾,并命名為bits

4、進(jìn)入bits文件夾,將之前創(chuàng)建的stdc++.h拷貝進(jìn)該文件夾中

四、如何尋找include文件夾:
特殊情況:如果找不到文件的辦法
1)右鍵你的vs,打開(kāi)文件所在的位置;往上走,返回到Community文件夾;


2)再到搜索框中搜索: cliext

3)同樣:右擊該文件,打開(kāi)文件所在的位置,即為include文件夾。
五、在vs2019中使用萬(wàn)能庫(kù):
代碼塊,檢驗(yàn)是否成功安裝:
#include <bits/stdc++.h>
using namespace std;
void solve() {
cout << "Hello World!\n";
}
int main() {
solve();
return 0;
}
運(yùn)行結(jié)果:

六、淺談萬(wàn)能庫(kù):
C++萬(wàn)能庫(kù)有利有弊,是一把雙刃劍:
利:
1)C++萬(wàn)能庫(kù)很方便;
2)使用C++萬(wàn)能庫(kù)后,不需要導(dǎo)入其他頭文件,節(jié)省時(shí)間;
3)在一些比賽中,是可以使用C++萬(wàn)能庫(kù),節(jié)省了比賽時(shí)間;
4)無(wú)需考慮自己有沒(méi)有少導(dǎo)入了哪一些庫(kù);
5)是代碼看起來(lái)整潔,少了很多導(dǎo)入頭文件的語(yǔ)句
弊:
1)不利于你的進(jìn)步,你會(huì)慢慢的依賴他,導(dǎo)致有些頭文件,你會(huì)忘記;
2)相對(duì)于你寫(xiě)一個(gè)文件時(shí)使用幾個(gè)庫(kù),只需要編譯這幾個(gè)庫(kù),然而C++萬(wàn)能庫(kù)需要編譯所有頭文件,導(dǎo)致編譯時(shí)間的增加,這是我們不愿意看到的;
3)在比賽中,容易導(dǎo)致TLE(Time Limit Exceed),即超時(shí);
總結(jié)
C++萬(wàn)能庫(kù)很好,但是不建議使用。
到此這篇關(guān)于C++萬(wàn)能庫(kù)頭文件在vs中的安裝步驟(圖文)的文章就介紹到這了,更多相關(guān)C++頭文件萬(wàn)能庫(kù)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
C++數(shù)據(jù)結(jié)構(gòu)與算法之判斷一個(gè)鏈表是否為回文結(jié)構(gòu)的方法
這篇文章主要介紹了C++數(shù)據(jù)結(jié)構(gòu)與算法之判斷一個(gè)鏈表是否為回文結(jié)構(gòu)的方法,結(jié)合實(shí)例形式分析了回文結(jié)構(gòu)并結(jié)合實(shí)例給出了C++判斷回文的操作技巧,需要的朋友可以參考下2017-05-05
詳解C語(yǔ)言中雙向循環(huán)鏈表的實(shí)現(xiàn)
雙向鏈表也叫雙鏈表,是鏈表的一種,它的每個(gè)數(shù)據(jù)結(jié)點(diǎn)中都有兩個(gè)指針,分別指向直接后繼和直接前驅(qū)。本文將用C語(yǔ)言實(shí)現(xiàn)雙向循環(huán)鏈表,需要的可以參考一下2022-06-06
一起來(lái)看看C語(yǔ)言的預(yù)處理注意點(diǎn)
這篇文章主要為大家詳細(xì)介紹了C語(yǔ)言的預(yù)處理,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下,希望能夠給你帶來(lái)幫助2022-03-03
C++實(shí)現(xiàn) vector 的四則運(yùn)算
本文給大家介紹的是在C++中實(shí)現(xiàn)高效的vector四則運(yùn)算的方法的相關(guān)資料,需要的朋友可以參考下2016-07-07
C++中vector迭代器失效問(wèn)題的原因及解決方案
迭代器(iterator)是一種用于遍歷數(shù)據(jù)集合的的對(duì)象,它提供了一種訪問(wèn)數(shù)據(jù)集合中元素的方式,而無(wú)需暴露數(shù)據(jù)集合內(nèi)部的細(xì)節(jié),使用迭代器,我們可以對(duì)數(shù)據(jù)集合中的每個(gè)元素進(jìn)行處理,本文介紹了C++中關(guān)于vector迭代器失效問(wèn)題的原因及解決方案,需要的朋友可以參考下2024-09-09

