How to set up C++ development environment

In this tutorial, you will learn how to set up a C++ development environment. You need an environment to compile and execute your C++ program successfully.

How to set up C++ development environment

You need the following software to set up a development environment in your system for C++.

  • Text Editor
  • C++ Compiler

Text-editor

A text editor is where we write our C++ code. Once you have written your C++ program, you must save it with .cpp, .cp or .c extension. These extensions tell the compiler whether it is a C++ program or not. The compiler will compile the source code if it has .cpp, .cp or .c extension otherwise not.

C++ Compiler

A C++ compiler is a software that converts high-level language into low-level language i.e. converts the source code with .cpp, .cp or .c extension into machine-understandable codes. There are many C++ compilers available for different platforms. They are given below.

C++ for Windows

There are many C++ compilers available for windows. Some of them are listed below.

  • Code::Blocks: Download it from here.
  • Borland C++: Download it from here.
  • Dev C++: Download it from here.
  • Turbo C++: Download it from here.

After downloading any of these compilers follow the usual procedure for installation. Once everything is done, you can start writing your C++ programs. Do not forget to save your file with the proper extension.

C++ for Linux

You can write and execute your C++ program on Linux using the GNU C++ compiler. Follow the below steps to install g++ on your Linux system.

  • Open your Ubuntu terminal.
  • Type the following command and press ENTER:
    sudo apt-get update
  • Type your sudo user password and press ENTER.
  • Then type the below command in the terminal and press Enter again.
    sudo apt-get install g++

To check whether g++ is installed on your computer or not, type the following command.

g++ -v

If the above step does not give any error that means g++ is installed on your computer. Now you can write and execute your C++ program anytime on your system.

C++ for Mac OS X

To compile a C++ program in a Mac OS, you need to download Xcode. You can download Xcode from the apple app store. You can also download it from here. Once you have completed installing process, you can start programming in C++ in your Mac OS.

Thank you.

Leave a Reply