1. Download
Mirror site: https://gcc.gnu.org/mirrors.html
The speed is also good: ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/
2. Unzip the installation dependent library
./contrib/download_prerequisites
3. Configuration
./configure--disable-multilib (does not generate a cross-compiler compiled for executable code for other platforms)
4. Compiling the installation
Make && make install
5. Test code
#include <iostream> #include <string> #include <iterator> #include <algorithm> #include < array> int main () { //Construction uses aggregate initialization Std::array<int, 3> a1{{}}; Double-braces required std::array<int, 3> a2 = {1, 2, 3};//except after = std::array<std::string, 2& Gt A3 = {{std::string ("a"), "B"}}; Container operations is supported Std::sort (A1.begin (), A1.end ()); Std::reverse_copy (A2.begin (), A2.end (), std::ostream_iterator<int> (Std::cout, "")); Std::cout << ' \ n '; Ranged for loop was supported for (auto& s:a3) std::cout << s << '; Std::cout << ' \ n '; }
If the following error occurs:
/usr/lib64/libstdc++.so.6:version ' glibcxx_3.4.21 ' not found (required by./test)
To update a soft connection:
/usr/lib64/libstdc++.so.6-/usr/lib64/libstdc++.so.6.0.21
GCC5.4 Installation