PDA

View Full Version : newbie :how to compile C++ prog in emacs editor



debuger2004
06-20-2003, 12:30 PM
new to linux
wanted to know how to compile cpp prog in vi or emacs
editor
pls help:confused:

task
06-20-2003, 01:04 PM
I dont think you can but you should have a gcc compiler on Linux that will do it for you.

Tiresome
06-21-2003, 12:49 PM
You are to compile it in console.

$ gcc prog.c -o prog
for C

$ g++ prog.c -o prog
for C++

or try manual pages
$man -a gcc
$man -a g++

mart_man00
06-21-2003, 01:03 PM
vim can do that in its command line mode thingy, i dont know how my self but its in vims help file.

Jaguar
06-21-2003, 01:15 PM
> vim can do that in its command line mode thingy, i dont know how my self but its in vims help file.

Do you mean `:w prog.c' then `:!gcc prog.c' in vim command?

mart_man00
06-21-2003, 01:16 PM
Do you mean `:w prog.c' then `:!gcc prog.c' in vim command?

yup, i forgot about the bang. now i have to see where output goes... this could come in handy, i normally use vim.

Zach L.
06-25-2003, 12:40 PM
In emacs: M-x compile

You could also setup a key to do it in your .emacs file. For example:

(global-set-key [f9] 'compile)

koxinga
06-30-2003, 09:11 AM
and if you have some errors on your code, M-` to go to the line...

you should also add something like that in your .emacs :

(global-set-key [f4] 'previous-error)
(global-set-key [f5] 'next-error)

koxinga
07-01-2003, 01:57 PM
oups, C-x M-`