Saturday, July 17, 2010

My First c++ program in Linux

Using any Text editor in Linux type the following program.For help refer



#include<iostream>using namespace std;
int main(){
cout<<"Hello world";

return 1;
}



To Compile type the following command
g++ sample.cpp -o sample
To run type the following command
./sample

If you don't have g++ compiler you will get err or as in screenshot.
then you may need to install g++ compiler.
For install become super user as in

To install type following command in terminal:

apt-get install g++

It will automatically download and install from Intern et.


Otherwise we can download
Code::Block IDE for compiling and running c++ program.


for that type following command as in screen shot:
apt-get install codeblocks




root user account in Ubuntu Linux

After installing Ubuntu Linux, I tried to install some softwares, but i don't have "Super user" or Administrator privileges. I know in some Linux "root" user like administrator account in Windows. I tried but i don't have have any user with name "root".

Then i found, the user I created when installing Linux itself a super user account.
Whenever I need Administrator privileges I need to use "su" command in Terminal to become super user.