On Fri, 27 Aug 2004, Sameer D. Sahasrabuddhe wrote:

> To edit your programs, use some editor like vi, emacs, gedit ... or
> any other that you like.
> To compile, use a suitable compiler. For C, for example,
> 
> $ gcc -o hello hello.c
 
I always prefer vi for writing small C programs. After you are comfortable
with vim you will love the simplicity yet power it offers. You can use 
vi as an mini-IDE! Here is how ...

For compiling you need to set makeprg as follows: 

press Esc Esc 

:set makeprg=/usr/bin/gcc\ '%'

Enter appropriate path of gcc above
here % refers to the current filename

now 
:make 

will compile the program and take the cursor to the first error !!

you can do 

:cnext
:cprevious

to step through errors.

to run your program:

:!./a.out

This is I think an IDE-like functionality in an editor --> Very Cool :)

Of course you can write a Makefile and simply say
:make

But for small programs the above method is very easy.


HTH
Nikhil 

-- 
   I say, if your knees aren't green by the end of the day, you ought to
seriously re-examine your life.  -- Calvin

-- 
http://mm.ilug-bom.org.in/mailman/listinfo/linuxers

Reply via email to