Thread: newbie :how to compile C++ prog in emacs editor

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    21

    newbie :how to compile C++ prog in emacs editor

    new to linux
    wanted to know how to compile cpp prog in vi or emacs
    editor
    pls help

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    66
    I dont think you can but you should have a gcc compiler on Linux that will do it for you.

  3. #3
    Tiresome
    Guest
    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++

  4. #4
    Registered User
    Join Date
    Jul 2002
    Posts
    913
    vim can do that in its command line mode thingy, i dont know how my self but its in vims help file.

  5. #5
    still a n00b Jaguar's Avatar
    Join Date
    Jun 2002
    Posts
    187
    > 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?
    slackware 10.0; kernel 2.6.7
    gcc 3.4.0; glibc 2.3.2; vim editor
    migrating to freebsd 5.4

  6. #6
    Registered User
    Join Date
    Jul 2002
    Posts
    913
    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.

  7. #7
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    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)
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  8. #8
    Registered User
    Join Date
    Jun 2003
    Posts
    6
    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)

  9. #9
    Registered User
    Join Date
    Jun 2003
    Posts
    6
    oups, C-x M-`

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 14
    Last Post: 12-07-2006, 03:19 AM
  2. Compile crashes certain windows
    By Loduwijk in forum C++ Programming
    Replies: 5
    Last Post: 03-26-2006, 09:05 PM
  3. newbie: steps to create and compile c program in SUSE
    By gemini_shooter in forum Linux Programming
    Replies: 12
    Last Post: 06-22-2005, 06:35 PM
  4. Quick Makefile Question
    By cisokay in forum C++ Programming
    Replies: 6
    Last Post: 05-16-2005, 06:28 PM
  5. PFE (prorgammers file editor, for Windows)
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 06-09-2002, 11:01 AM