|
Compiling C with Emacs
|
|
05-25-2010, 10:53 AM
(This post was last modified: 05-25-2010 10:54 AM by Back_track.)
Post: #1
|
|||
|
|||
|
Compiling C with Emacs
Compiling C in Emacs 23, A tutorial.
First of all, you'll have to get Emacs. This is as simple as going to your Package Manager and finding Emacs under the Programming or Accessories location(s). Once you have downloaded Emacs, we can begin. ![]() Start up your Emacs and get ready to begin ![]() ![]() Create a new File by Code: File->Visit New File->(Specify new File name WITH extension then hit Open)I'll name this, P9.c Start typing out your C code, mine will be this: Code: #include <stdio.h>If you don't understand this code, look it up. That is not what this is about. The syntax highlighting should look like this if done correctly ![]() Since your code is written, before compiling. You have to save it. The easiest way to do this is to hit the Icon that looks like a HD with an Arrow ![]() Once saved, we can move on to compiling. To do this we would do as follows Code: Tools -> CompileQuote:Compile command: make -k I've never been too fond of make files my self so lets go with the gcc commands ![]() My compilation commands are just gcc "path of file" Code: gcc /home/steven/Documents/EMACSC/P9.c![]() (Optional) If you want to run/debug your program in Emacs you could do this: Tools->Debugger(GDB) Once you click that, you'll get a prompt on the bottom window with something like this Code: Run gdb (like this): gdb --annotate=3 a.outThe parameters are just running the debugger with the default name for your executable. Once it opens Run gdb (like this): gdb --annotate=3 a.out your program just hit the green Icon that says "GO" and it will run your program. Happy coding
"Character is determined more by the lack of certain experiences than by those one has had." Friedrich Nietzsche |
|||
|
« Next Oldest | Next Newest »
|



![[Image: screenshot-emacs-sunburst.png]](http://lh3.ggpht.com/_4F2P0FQZ3bE/SQ3bqqC3cpI/AAAAAAAAA9s/66NHwYC0x0I/screenshot-emacs-sunburst.png)

![[Image: 62555_screenshotemacs23stevenlaptop.png]](http://myph.us/pics/62555_screenshotemacs23stevenlaptop.png)
![[Image: 62556_screenshotemacs2.png]](http://myph.us/pics/62556_screenshotemacs2.png)
![[Image: 62557_screenshotico.png]](http://myph.us/pics/62557_screenshotico.png)
![[Image: 62554_compilation.png]](http://myph.us/pics/62554_compilation.png)


