C++ universal library header file installation

Preface

Installation of C++ universal library header file in vs2019

1. What is the C++ universal library?

1. Definition of C++ Universal Library: In short, one statement replaces multiple statements, including all header files currently included in C++

2. The writing method of C++ universal library: #include <bits/stdc++.h>

2. Contents of C++ Universal Library:

The following are the header files of all C++ library functions included in bits/stdc++.h:

#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

3. How to import the C++ universal library into vs2019:

1. First: create a new text file on the desktop;
      second: copy the code in (2) into the text file, save and exit;
finally rename it to: stdc++.h
Insert picture description here

2. Find the file location of vs in the computer: find the include folder under VC.
Local path D:\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include
Insert picture description here

3. Create a new folder in the include folder and name it bits
Insert picture description here

4. Enter the bits folder and copy the previously created stdc++.h into this folder
Insert picture description here

Fourth, how to find the include folder:

Special case: If you can't find the file,
    1) Right-click your vs and open the location of the file; go up and return to the Community folder;
Insert picture description hereInsert picture description here

    2) Go to the search box and search: cliext
Insert picture description here

    3) Same: Right-click the file and open the location of the file, which is the include folder.

5. Use the universal library in vs2019:

Code block to verify the successful installation:

#include <bits/stdc++.h>

using namespace std;
void solve() {
    
    
	cout << "Hello World!\n";
}

int main() {
    
    
	solve();

	return 0;
}

operation result:
Insert picture description here

Six, talk about the universal library:

The C++ universal library has advantages and disadvantages, which is a double-edged sword:
advantages:
1) The C++ universal library is very convenient;
2) After using the C++ universal library, there is no need to import other header files, which saves time;
3) In some competitions, yes You can use the C++ universal library, which saves game time;
4) You don’t need to consider whether you have imported less which libraries;
5) The code looks clean, and there are a lot of fewer import header files.
Disadvantages:
1) Not conducive to your progress , You will gradually rely on him, leading to some header files, you will forget;
2) Compared with several libraries when you write a file, you only need to compile these libraries, but the C++ universal library needs to compile all the header files. This leads to an increase in compilation time, which is something we don’t want to see;
3) In the game, it is easy to cause TLE (Time Limit Exceed), that is, timeout;

to sum up

The C++ universal library is good, but it is not recommended.


Please correct me if there are any errors!

Guess you like

Origin blog.csdn.net/ivan_9/article/details/113062927