Hi,
Is this what you are looking for:
Code:
map <F3> : call CompileGcc()<CR>
func! CompileGcc()
exec "w"
exec "!gcc % -o %<"
endfunc
map <F4> :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
exec "!gcc % -o %<"
exec "! ./%<"
endfunc
This, when added to your vimrc, will use F3 to compile and F4 to compile and run. Errors (if any) and output is shown.
Hope this helps.