Home >>C++ Tutorial >C++ Installation

C++ Installation

Installation of C++

In order to setup the installation of the C++, two software are mandatory to have in your computer before you begin with the installation.

The first software is Text Editor

In order to type your program before compiling, you have to write it somewhere that is why the Text Editor is used. There are several text editors that can be used for this purpose such as: Windows notepad, OS Edit command, Epsilon and vim.

Please note that the versions and name of the text editors can vary as per the operating systems. For instance, notepad is used in the windows and vim can be used in the windows as well as Unix or Linux.

Source files are the files that are created with the text editor and in case of C++, the extension of the file is .cpp, .cp or c.

A text editor will come in handy in order to start your C programming.

C++ Compiler

This compiler has a function that can be used to compile your C++ program. Please note that it is an actual C++ compiler that compiles your source code in to a final executable program.
The extension that is given to your source code can be different as many compilers don’t care what extension is given. Until and unless you specify the extension, the .cpp extension will be used by default.

There are many compilers that are available on the web but GNU C/C++ compiler is the one that is used most frequently and is available for free. If not comfortable with this compiler then you can search for other compilers that are compatible with your operating system.

Here is the steps how you can install the GNU C/C++ Compiler

Let's understand the installation process on various operating systems.

Installation in Windows

In order to install the GCC, you need to install MinGW first in the windows. To install the MinGW, just visit their website and follow the simple instructions of installing the same. It is recommended to download the latest version always that will mentioned on the software file name.

While you are installing the MinGW, there is a minimum requirement that insists that these software likegcc-core, gcc-g++, binutils, and the MinGW runtime must be installed along with the MinGW. Installation of these sub programs are not limited to these softwares, in fact is the user wants then he can install more of them as per the requirement.

After following the installation steps that are mentioned on the software’s website, you will be able to run gcc, g++, ar, ranlib, dlltool, and several other GNU tools right from the command line of windows.

UNIX/Linux Installation

In Linux/UNIX there is a need for entering the command line for any installation. In order to install, check whether the GC C is installed in your system or not by just entering the below mentioned command line:

$ g++ -v

If the GCC is already installed in your system then the following message will be printed:

Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr .......
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)

In case the software is not installed then you have to visit the website of GCC and install it by following the steps that are mentioned on their website.

Mac OS X Installation

Users who use Mac OS X means that they have access to Apple’s App Store. They just need to logon to the Apple’s website, search for the Xcode development software and follow the steps that mentioned on the website and install it.