x

C++ language Introduction

Prev     Next

C++ is a programming language which includes the main four pillars of object oriented development. Those concepts are:


  • Data Hiding
  • Inheritance
  • Encapsulation
  • Polymorphism

What are the features of C++?

C++ is an object oriented programming language. Some of the features are:

  • It is a mid-level programming language.
  • It supports the dynamic memory allocation.
  • C++ is a machine independent but not platform independent.
  • It provides lots of inbuilt functions.

Setting C++ Local Environment

Now to learn C++ programming language you need to set up the C++ programming environment, so that you can compile and execute the programs. So, now you will learn how to set up the local environment on the system.

  • Text Editor – The text editor is used to type your program and they are Notepad, Epsilon, vim or vi, etc. The text editor can have different name and version that can vary on different operating systems. For example, the Notepad editor will be used on Windows and vim or vi can be used on Linux or UNIX as well as Windows. And the files which you create on editor are known as source files and saved with the .cpp , .cp or .c extension.
  • Compiler – The compiler is that which will be used to compile the source code into executable program. By default, the compiler use .cpp extension.

Now, let us have a look at how to install GNU C/C++ compiler:

Installing on UNIX/LINUX  

So, here you will learn how to install gcc compiler on Linux or UNIX and then check whether gcc is installed on your system or not by entering the following command on the command line:


$ g++ –v

  • And if you have installed compiler on your machine, then it should print a message:

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)

  • And if gcc is not installed on your system, then you have to install manually by using the detailed instructions which is available at http://gcc.gnu.org/install/

Installing on Mac

Now, in this topic you will learn how to install gcc on Mac operating system. To download gcc on Mac the easiest way to install the Xcode development environment is from Apple’s website and follow the installation instructions and once you have the Xcode setup, then you will be able to use the gcc compiler for C/C++. You can install the Xcode setup from developer.apple.com/technologies/tools/

Installing on Windows

Now, to install gcc on Windows, you need to install MinGW. To install MinGW, just go to the MinGW homepage, www.mingw.org and then follow the link to the MinGW download page and download the latest version of MinGW installation and it should be named MinGW -<version>.exe

And while installing MinGW, you must install gcc-core, gcc-g++, binutils and the MinGW runtime. Then add the bin subdirectory of your MinGW installation to your PATH environment variable, so that you can specify these tools on the command line. And as the installation is completed now, you are able to run gcc, g++, dlltool and some other GNU tools from the windows command line.

Prev     Next



Like it? Please Spread the word!