Running C++ and C programs in Linux

This page is going to be simple and sweet and apart of the Linux C++ section. Don't worry Windows users I haven’t forgot about you. I will create a new section for Linux users though because I have noticed that some of my users are Linux users. This is according to my web statistics.Before we start programming the first thing you must do is install g++.
Open terminal> type sudo apt-get install g++ when working with c install gcc and remember to save the text file as a .c extension



There are several capabilities with Linux as a C++ builder. I actually prefer building programs in for simplistic purposes I will use the simple gedit word processor as a complier.


Take a look at the images below:(click to enlarge)

The first picture is before we save it as a .cpp file.
1) click save as
2)In the title textbox delete everything name it what ever you want but then add a .cpp extension.
3). Click save and notice the colour coded text. ( see image 2)

Image 1
Image 2

Image 3


Now we have output to the screen. You just built your first program in linux congratulations! Now you just apply this to the other things you learn in c++ when working in linux or other unix based operating systems.

No comments:

Post a Comment