How to install C++ || Step-By-Step Tutorial || How to install C++ In Windows 10 || Installation of C++ || How to install C++ MinGW || How to install C++ In VS CODE || How to use C++ In VS Code || VS Code Installation

How to install C++? How to compile and run it?

By- Yashvardhan Singh

Introduction

C++ is a general purpose programming language, widely used by developers. It is a cross platform programming language. Unlike Ruby, PHP or Python, C++ is a compiled language, which means the code written in C++ needs a compiler which will compile it in a the machine understandable language.

Let us learn how to install a C++  compiler:

Compiler installation

Before we begin with the installation let us know about what compilers are openly available and are free to use. The following is a list of such C++ compilers:

    • MinGW
    • Cygwin (GNU C++) 
    • Clang
    • Microsoft C++
    • Oracle C++

Now let's have a look at the installation process for MinGW:

 Go this link and download the files from the highlighted link:

Tap to enlarge

Now extract this downloaded file and save this 'MinGW' folder in your C:\ drive, the extraction will look like:

Tap to enlarge

Setting up the path for Compiler:

We should add the path of our compiler to the environment variables so that we can use it from anywhere, in our system. This step is very important otherwise your code editor or command prompt may not know that even a compiler is installed on your system and an error "gcc is not recognized as internal or external command, operable program or batch file" or "minGW not found"

So let's have a look at the process:

    1. Navigate inside the 'MinGW' folder and navigate to 'bin
      Tap to enlarge

    2. Copy this path and open Control Panel -> System -> Advanced System Setting -> Environment Variable -> Edit path from System variable -> new
    3. Then paste this copied path there, and save everything by pressing OK

      Tap to enlarge
Now we are done with the installation of our C++ 17 MinGW compiler.

VS Code Installation

Now we need to install a code editor which helps us to write, compile and debug  our code easily. There are many code editors and IDE out there but nowadays VS Code offers a lot of exciting features which will help you to easily work on bigger projects. However, there is nothing wrong in using the good old Notepad.

Go to this link,  and download the version suitable for your system.

Tap to enlarge

After downloading the file you should start installing it with all the default configurations, just make sure to select/check "Add to path" in the second step (after accepting the T&C).

Tap to enlarge


After installing you are done with the 90% of the stuff, now you just need to do some configurations in VS Code.

  • Go to the extensions from within VS Code using the search Bar install the extensions shown here

Tap to enlarge

  • After installing these extensions just one last thing is left. Now go to the extension settings of Code Runner.

    Tap to enlarge

  • Now in the search bar at the top search "run in terminal" and check the checkbox in both the user and the workspace tabs. This step is important as the default setting is to display the output in a read only tab, but we don't want that so we use the integrated terminal which accepts the inputs as well.

    Tap to enlarge

That's it! Hooray! 

Now you are ready to write your first C++ code, compile it and run it. This will be covered in the next part of this series.

Comments

Popular posts from this blog

Basics Of Operators||Basics of operators in C++||Basics of operators in cpp||Types of operators in C++||Arithmetic Operators||Comparision Operators||Binary Operators||Logical Operators||Bitwise Operators||Assignment Operators||Miscellaneous Operators||Bitwise Explained||Operators Precedence||

Conditional Statements in C++