Sunday, November 11, 2007

C over a Terminal in Gutsy Gibbon

Today I'd like to show you how to write an 'Hello World' application in C language under Ubuntu 7.10 Codename Gutsy Gibbon over a terminal without using an IDE.

If you have the same version of Ubuntu (VMWare Image) as I have then you have the newest version of the GNU C Compiler collection (4.2.1) out of the box and you don't have to lose time for preconfiguration stuff to develope C-applications. The first step is to open a new terminal under Ubuntu.



Then you have to create a new C-file with an editor of your choice. I prefer nano, so I typed nano test.c and the editor opens in the terminal with your file.



The next step is to write your 'Hello World' C-code and save it by pressing Strg+X (in nano), 'J' and 'Enter'. After those steps nano will save your code to your test.c file and you'll be able to compile it.









By typing gcc test.c the gcc-compiler will create an executable (if there are no errors in your application) and it's default name will be a.out. You will be able to execute it by typing ./a.out and press 'Enter'. Then you should be able to see your 'Hello World'-output.







Hope you liked this short tutorial about how to write a simple 'Hello World' application in C over a terminal in Ubuntu 7.10.

Cheers

1 comment:

donnaj edwards said...

Thank you for your articles that you have shared with us. Hopefully you can give the article a good benefit to us. IT Profi Berlin