Wednesday, November 17, 2010

How to Install C++ in ubuntu?

C++ in Ubuntu is called G++. To Install this:
  1. Right click on the desktop and choose create a document , then choose empty file.
  2. Give it any name with the extension .sh .For Example- priya.sh
  3. Open the file and write the following command:
sudo apt-get install g++
  • Now save the file by choosing file>>save.
  • Now right click on the file and choose Permission Tab.
  • Change to Read and Write File and click in the checkbox "Allow Executing Files as program"
  • Now open the terminal by choosing Applications>>Accessories>>Terminal
  • Now type the following:
cd Desktop  (to go to desktop in terminal)
./priya.sh      (to run the file to install g++ in terminal mode)

Press "y" for continue.
Your g++ has been installed now.
To run the programs in g++:
  • First write the program in the file with the extension .cpp. e.g rr.cpp
  • To run the program, go to the terminal and write the command:
cd Desktop
g++ rr.cpp 

  • With this a blue colour file will automatically be created on the desktop i.e a.out
  • Also in the terminal you will remain on the prompt sign even after gining the above command
  • now write;
./a.out          (to run the program in terminal)

1 comment:

  1. In brief:

    1) Applications>>Accessories>>Terminal
    2) sudo apt-get install g++

    [Copied and pasted from original post]

    ReplyDelete