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.
Install C++17 Compiler(GCC 9.2)
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:
Setting up the path
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 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 commmand in CMD:
gcc –version
It must be 9.2 if it is installed successfully.
Setup Guide for Sublime Text
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.
Setup Guide for CodeBlocks
- Go to global Compiler setting -> select compiler as GNU GCC compiler
- Mark c++17 in compiler setting as:
- Switch to Toolchain executable 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:
Recommended Posts:
- How to Install Linux on Windows PowerShell Subsystem?
- OpenMP | Introduction with Installation Guide
- Beginner's Guide to Linux System Administration
- Step By Step Guide to Add Custom Keyboard Shortcut in Ubuntu
- How to Install VirtualBox in Linux?
- install command in Linux with examples
- How to Install Katoolin on Linux Mint?
- How to Install Lazy Script in Kali Linux?
- How to Install Chrome in Ubuntu?
- How to Install and Configure Docker in Ubuntu?
- How to Install and Configure Fish Shell in Ubuntu?
- How to Install Ulauncher in Ubuntu?
- How to Install Z Shell(zsh) on Linux?
- How to install Ubuntu on VirtualBox?
- How to Install and Configure Synaptic Package Manager in Ubuntu?
- How to Install and Configure Apache Subversion(SVN) In Linux?
- How to Install and Configure Elasticsearch on Ubuntu ?
- How to Install and Configure MongoDB in Ubuntu?
- How to Install and Use Hydra in Linux?
- How to Install TeamViewer on Linux/Ubuntu?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.





