Open In App

Complete Guide to Install C++17 on Windows

Last Updated : 05 Oct, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

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:  

  1. Copy the bin folder path from MinGw file saved in C drive
  2. 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.  

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 

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: 

Setup Guide for Dev – C++

  • 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:


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads