Complete Guide to Install C++17 on Windows - GeeksforGeeks

05 Oct, 2021
In the Competitive Programming field C++ is one of the most used language, because of it’s huge STL(standard template library) functions, and day by day its getting updated. So here is the complete guide to install the latest version of C++(C++ 17) and also setup guide for Sublime Text and CodeBlocks.
To install C++17 compiler follow this link to download GCC 9.2 compiler. After download is completed, extract the file and save the extracted MinGw folder in C drive as shown in below images:
If you are installing GCC compiler first time in your computer follow the steps below:  
Copy the bin folder path from MinGw file saved in C driveGo to Control Panel -> System -> Advanced System Setting -> Environment Variable -> Edit path from System variable -> new -> paste the path and save every thing. 
Copy the bin folder path from MinGw file saved in C drive
Go to Control Panel -> System -> Advanced System Setting -> Environment Variable -> Edit path from System variable -> new -> paste the path and save every thing. 
If there is previously installed any GCC compiler then follow the same process to setup new GCC compiler path or just replace the previously existing MinGw folder with this new MinGw folder in C drive. Now, check the version of GCC installed on your computer to verify that is it successfully installed by running the below command in CMD: 
gcc --version
It must be 9.2 if it is installed successfully.  
In Sublime Text editor while running a C++ code it gives warning for some newly added functions of C++17 STL and due to default build setting of C++ program would not run if it has any warning. To overcome this problem we will add our custom build code for C++ program as:  
{
    "cmd" : [ "g++.exe", "-std=c++17", "${file_name}", "-o",
              "${file_base_name}.exe", "&&", "start", "cmd",
              "/k", "${file_base_name}.exe" ],
    "file_regex" : "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "shell" : true,
    "working_dir" : "$file_path",
    "selector" : "source.cpp",
}
Copy the above code and create new build system (Tool -> build system -> new build system). Name it anything you want and save it with sublime-build extension. Now Go to tool -> build system and select the build file that you saved earlier, and we are done. 
Now, to run your code press Ctrl + B.  
1. Go to global Compiler setting -> select compiler as GNU GCC compiler
2. Mark c++17 in compiler setting as: 
3. Switch to Toolchain executables tab -> select MinGw folder from C drive in Compiler’s Installation directory and also update all the program files from C-> MinGw -> bin folder.
Below is the illustration of the same: 
Go to Tools -> Compiler Options -> ‘+’ button  (Add a compiler set by folder)
Select the MinGW folder from C drive -> Click Ok to save the settings.
Change the version/type of compiler anytime back to the previous one or this new one, using this drop-down menu:
menonkartikeya
sweetyty
how-to-install
C++
Competitive Programming
Installation Guide
Linux-Unix
CPP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Operator Overloading in C++
Polymorphism in C++
Friend class and function in C++
Sorting a vector in C++
std::string class in C++
Competitive Programming - A Complete Guide
Practice for cracking any coding interview
Arrow operator -> in C/C++ with Examples
Prefix Sum Array - Implementation and Applications in Competitive Programming
Fast I/O for Competitive Programming