'Why is org-babel not recognizing C code?

I am running version 7.01 of org-mode on emacs version 24 with Ubuntu 12.04 and I am unable to use C source blocks. The default emacs-lisp language works fine, though.

Typing C-c ' does not create a separate buffer for entering C-code but instead states, ``No such language mode:C-mode'' in the minibuffer.

Typing C-c C-c will only produce the following message, ``Before first headline at position 15 in buffer src.org,'' for any choice of code in the body of the block. For example,

 #+begin_src C
 #include <stdio.h>
 printf("hello");
 #+end_src

My current value of org-mode-load-languages is ((emacs-lisp . t) (C . t)). Is there another variable to configure that I'm missing?

All of the documentation I've read on using code blocks only refers to changing the org-mode-load-languages variable to start using supported languages. Any thoughts or suggestions on where the problem is would be appreciated.

Thanks.



Solution 1:[1]

Just had this same issue 9 years later.

Make sure you've made the language available to Babel:

  (org-babel-do-load-languages
   'org-babel-load-languages
   '(
     (C . t)  ; provide C, C++, and D
     ))

The name of the Babel source file for C-like languages is ob-C.el. You'll also need the to be compiler on your PATH.

See the docs for more information: https://www.orgmode.org/worg/org-contrib/babel/languages/ob-doc-C.html

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lorem Ipsum