Difference between revisions of "C"

From WikEmacs
Jump to navigation Jump to search
m
(add compile)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories. It is one of the most widely used programming languages of all time. See [http://en.wikipedia.org/wiki/C_%28programming_language%29 Wikipedia article].
 
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories. It is one of the most widely used programming languages of all time. See [http://en.wikipedia.org/wiki/C_%28programming_language%29 Wikipedia article].
  
The default [[major mode]] associated with C files ({{File|.c}} and {{File|.h}}) is {{ModeLink|cc-mode}}.
+
In Emacs the default [[major mode]] associated with C files ({{File|.c}} and {{File|.h}}) is {{ModeLink|c-mode}}.
  
 
== Browsing code ==
 
== Browsing code ==
  
[http://cscope.sourceforge.net/ Cscope] is the de-facto tool for browsing C code. The package is bundled with ''xscope.el'' library which enables use of cscope from within Emacs.
+
[http://cscope.sourceforge.net/ Cscope] is the de-facto tool for browsing C code. The package is bundled with {{ModeLink|xscope}} mode which enables use of <tt>cscope</tt> from within Emacs.
 +
 
 +
== Compiling ==
 +
 
 +
* While in your C source file, run {{Command|compile}}
 +
* Type the compile command and hit RET
 +
* You can recompile without being prompted with {{Command|recompile}}
  
 
== Debugging ==
 
== Debugging ==
  
[[gdb]] -- the GNU Project Debugger -- can be embedded in Emacs.
+
[[gdb]] (the GNU Project Debugger) can be embedded in Emacs.
  
 
While browsing your project's code:
 
While browsing your project's code:
 
* Run {{Command|gdb}} to start a new gdb session
 
* Run {{Command|gdb}} to start a new gdb session
 
* Specify gdb parameters for your project.
 
* Specify gdb parameters for your project.
* A new buffer "<code>*gud-xxx*</code>" for the gdb session is created.
+
* A new buffer {{Buffer|*gud-xxx*}} for the gdb session is created.
  
  
 
[[Category:Programming languages]]
 
[[Category:Programming languages]]

Latest revision as of 14:12, 31 March 2012

C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories. It is one of the most widely used programming languages of all time. See Wikipedia article.

In Emacs the default major mode associated with C files (.c and .h) is c-mode.

Browsing code

Cscope is the de-facto tool for browsing C code. The package is bundled with xscope mode which enables use of cscope from within Emacs.

Compiling

  • While in your C source file, run M-x compile
  • Type the compile command and hit RET
  • You can recompile without being prompted with M-x recompile

Debugging

gdb (the GNU Project Debugger) can be embedded in Emacs.

While browsing your project's code:

  • Run M-x gdb to start a new gdb session
  • Specify gdb parameters for your project.
  • A new buffer "*gud-xxx*" for the gdb session is created.