Today I wish to tell about how to compile and run C/C++ programs in ubuntu 10.10.If you are a developer of C/C++ you need a compiler for the development of the programs.Ubuntu 10.10 has the compiler inbuilt with the operating system.Incase if the compiler is missing you download the package and able to install.
To download -Open the terminal and type the following.
sudo aptitude install build-essential
this will install the required packages of C/C++ compilers.
How to compile and run the C program
1.From the apllications open the terminal and type sudo gedit first.c
This will open a new file type the C program and save it
for eg. #include<stdio.h>
int main()
{
printf("Hello,world\n");
return 0;
}
2.for compiling type cc -c first.c
that will create an object file and add to the library.
3.then create an executable file using the following command
cc -o first first.c
4.Then run the Program by typing
./first
5.Output should be asfollows
Hello,world
How to compile the C++ program.
If you want to run a C++ program you must need a g++compiler.
1.create a file using sudo gedit first.cpp
eg.#include<iostream.h>
int main()
{
std:: cout << "Hello world!" <<std::endl;
return 0;
}
Run your C++ program using the following command
g++first.cpp -o test
then
./first
Output will be as follows
Hello, world!
Tags:Ubuntu compiling C & C++ in ubuntu
Upgrading Ubuntu 10.10 maverick meerkats from ubuntu 10.04 lucid karmic
Saturday, October 16, 2010
Are you using the older versions of ubuntu?It's time to move forward to the new linux ubuntu10.10 maverick meerkats.The full version of the ubuntu10.10 has been launched.
Upgrading the Desktop edition:
So to upgrade the desktop edition press ALT+F2 and type update-manager -d in the command box.Update manager opens and tells you a new version of Ubuntu is available.
1.Press ALT+F2 and type update-manager -d
2.The following screen will be appeard.Frist install all the updates and then click for upgrade.
Upgrading Server edition:
To upgrade from Ubuntu 10.04 LTS on a server system:
1- install the update-manager-core package if it is not already installed:
sudo apt-get install update-manager-core
2- Edit /etc/update-manager/release-upgrades and set Prompt=normal;
3- Launch the upgrade tool with the command
sudo do-release-upgrade -d
and follow the instructions..
Ubuntu 10.10 now available for download
The release of ubuntu 10.10 is held on 10-10-10 and now it is able to download.It is available in both 32-bit and 64-bit.The editions present are Desktop,Netbook and Server.Enjoy the multitouch netbook editions........
click here to download
click here to download
Subscribe to:
Posts (Atom)