Submitted by 007hack on Sat, 25/10/2008 - 21:27.
( categories: )

first of all this is for people who dont know how to compile c on linux cause i didn't use the bash for some time i had some difficulties to get to compile the programs but i managed to at last !

so let's start from the begining.

--open your terminal (if u dont know how then go to .... goggle)

ok then there are 2 programs to use 1- gcc 2- vi

those programs are in every Linux's distribution (I think so!)

ok first thing is to create a file to write into by using (touch)

try this

>>> touch test.c

then

>>> ls

you will find the new file listed like this

ash@localhost ~$ ls

Desktop/ Download/ Pictures/ test.c* tmp/

Documents/ Music/ Videos/

then now you can open it using (vi) "a simple text editor"

>>> vi test.c

ok now if you want to insert text press (i) and type what ever u want

then after u finish press Esc then type

" (:wq) to quit with saving OR (:q)to quit without saving "

if u did press Esc without noticing(i always do) u can return to text inserting mode by pressing (i)

BTW : to quickly view a text file type in termenal >>> cat test.c

now try to write this to the file

  #include <stdio.h>

int main()

{

printf("fokak meny\n");

return 0;

}

then save

to compile it then type in termenal

>>> gcc -o test.o test.c

the test.o is the output file

to run ur program simply type in termenal

>>> ./test.O

if u want more knowledge in those commands type(for example)

>>> man vi

>>> man cat

that's all folks!!

N.B: plz replay if u need more of those stupid lessons (no replays means that everybody there has already done all this before so no need for this )

thank you

ASH


Very nice work

Dear ASH

very good work but there is a small mistake and correct me if i'm wrong

>>> ./test.c

should be

>>> ./test.o

but very good tutorial.

have fun

Linux Let's Free The World

SORRY MY BAD

007hack's picture

THANK U MAN,I CORRECTED IT

never mind

no problem man

but the topic needs reformatting if u have time :)

Linux Let's Free The World

nice

linuxawy's picture

nice work guys, why don't you add this to the wiki?


Ahmed D. El-Mekkawy

My blog

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.