0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
What do you do between editing and running? There'll be a :w to save the file of course, but then what? (I assume we're talking about vim as "vi improved", if not then I'm probably talking pants).

A compiler is a tool that converts C code into an executable. vim is a text editor, not a compiler. A shell is a shell, not a compiler. Maybe vim allows you to invoke a compiler with a : command of some kind, in which case vim is acting as an IDE (integrated development environment). IDE's batch stuff up for you so as to streamline the development process, for example in Visual Studio you can edit code then hit F5 to run it in a debugger: this will save the file(s), compile them, link them and start the debugger all in one keypress.

If you're learning to program then you really need to understand the tools you're using. When editing a file in vim, save and exit, then invoke the compiler manually from the command line. It's a good idea to explore compiling and linking as two separate steps to get the hang of how it all works.
0
kaporal_p's Avatar, Join Date: Jun 2010
Light Poster
Yes, it's Vi improved 7.2

I edit, I save and then in comand prompt : gcc filename.c -o filename

I do this like a robot of course, well not that blindly but almost. So I guess gcc is calling a compiler? but where it comes from I dunno, I never installed anything called gcc... -o seems to be what is converting the file to i/o I guess.

So, gcc filename.c -o filename, would be : compiling then linking the file???

Ok I guess I still have a bit of reading to do...

Thanks
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
yep, there you go. gcc is a compiler: google it for more info. "gcc filename.c -o filename" compiles and links in one step to produce the executable "filename" directly from source "filename.c". If you save and exit with :wq then enter "gcc filename.c -o filename" directly at the shell prompt then you will see, providing it's on the PATH of course.
kaporal_p like this