Questions tagged [c]

is for C source code editing, completions, formatting, compiling, folding, searching, executing, syntax checking, debugging, and other modern IDE features that Emacs supports.

Use the tag for C and Related Modes, which include C, C++, Objective-C, Java, CORBA IDL, Pike and AWK modes.

Emacs also provides basic support of programming through the .

There are separate tags for and as well.

Useful Links:

110 questions
11
votes
3 answers

How can I automatically insert a prototype in foo.h from foo.c?

Suppose I'm writing a C program in a file foo.c: int add_numbers(int x, int y, int z) { // Very complex implementation here. return x + y + z; } I want a command that will insert a corresponding function prototype in foo.h: int…
Wilfred Hughes
  • 6,920
  • 2
  • 31
  • 60
5
votes
2 answers

emacs cscope integration basics

I am a long term eclipse CDT user migrating to emacs (ver. 23.3.1), because I have to work on a large C codebase accessible only through a telnet/ssh shell. After going through several online guides, I have managed to get emacs work with cscope on…
Karko
  • 51
  • 1
  • 2
5
votes
2 answers

Swap two statement on adjacent lines in C when one statement takes multiple lines

Assume that I have the following code: int x; string s = "some very long " " string"; I would like to have one command that swaps the order of these without ending up with something like: string s = "some very long" int x; …
eof
  • 91
  • 1
0
votes
0 answers

Use iconv directly on the selected region to convert codes

I copied and pasted the C code as: int main(void) {    statements    return 0; } to org's babel code block, when strike C-c C-c, it report error: /tmp/babel-uaYVXU/C-src-Pd1SZs.c:11:6: error: stray ‘\240’ in program 11 |    statements | …
Wizard
  • 1,251
  • 6
  • 17
0
votes
1 answer

Compilation exiting abnormally with code 1 only when inside Emacs + liking to pthread library

Only when I'm trying to compile + link to the pthread library, I'm getting this error from Emacs: -*- mode: compilation; default-directory: "~/GITHUB/kandr/" -*- Compilation started at Mon Nov 14 02:50:59 cc -Wall -Wextra -pedantic -std=c11 -g…
Nsukami _
  • 6,521
  • 2
  • 23
  • 35