views:

70

answers:

1

I am new to programming, and even newer to Linux. I was told that Linux is the best OS to learning to program as it lets a programmer interface closely with the machine architecture. I heard a lot about the GNU tool-chain and that it provides the best programming environment on Linux so I decided I won't use an IDE and put in as much time is needed to learn things the right way.

I have just finished installing Ubuntu 10.10. I installed Vim and started learning to use it for my text-editor. Also I have been able to verify that GCC and GDB are present on my system. I am learning to program in C from the book - Computer Science: A Structured Programming Approach using C. Though it explains how editor, compiler, linker and runner are used to develop and run programs, it doesn't explain how to set them up and use them. So my question is, once I have the source-code written in my text-editor, how do I invoke the GNU tool-chain to compile and run my program.

+2  A: 

save it with some name, e.g. filename.c and then call gcc and invoke the binary (named a.out by default)

gcc filename.c
./a.out
srean
@Ignacio Thanks for the edit
srean
Sure thing. Took me a few minutes to remember that I can actually do that...
Ignacio Vazquez-Abrams
+1 to say thanks :)
srean
Thank you srean and Ignacio.
Harsh Vardhan