I'm trying to execute C and/or C++ snippets in Org Babel. For example, I want to be able to execute the following snippet with C-c C-c:

#+begin_src C
printf ("Hello World!");

The documentation states that there are two installation steps: (1) having a C compiler available from PATH, and (2) having C added to the Org Babel load languages variable.

When I do this and I try to run the above code snippet, I get the following message:

Evaluation of this C code block is disabled.

The message suggests that there is something wrong with this particular code block (the use of the world this), but other code snippets result in the same message.

Was anybody able to run C and/or C++ code blocks in Org Babel? Were more installation steps needed?

I'm using Org mode 9.1.2 and GNU Emacs 25.3.1. Org Babel code block evaluation does work for other languages (e.g., SPARQL, SML, ELisp).

  • Are the source code block lines above the only text in the org file? Note that you can explicitly enable and disable a programming language in org-babel-load-languages. Double-check that Activated is really on for C! Is the value of org-babel-C-compiler meaningful on your system?
    – Tobias
    Oct 6, 2017 at 20:08
  • @Tobias Yes, the Org file only contains the hello world code block. (eval org-babel-C-compiler) gives gcc. I'm not sure what Activated is? (eval org-babel-load-languages) gives Invalid function: (C . t). Oct 6, 2017 at 20:38
  • 1
    See that orgmode-ticket: github.com/syl20bnr/spacemacs/issues/7641. There they say that removing all the compiled files *.elc and byte-compiling the sources does the trick.
    – Tobias
    Oct 9, 2017 at 12:59
  • 1
    Possible duplicate of: emacs.stackexchange.com/questions/28441/…
    – Tobias
    Oct 9, 2017 at 13:01
  • 1
    The fix was to do rm ~/.emacs/elpa/org-20171009/*.elc and then restart Emacs. The overall issues seems to be an inconsistency between Org mode versions. Very annoying that updating/installing Org does not automatically rebuild the *.elc files :( Oct 10, 2017 at 2:00

2 Answers 2


The solution was basically given by @Tobias who shared the following links:

It is important to note that removing Org, restarting Emacs, and installing Org did not work for me. And C-0 M-x byte-recompile-directory RET ~/emacs.d/elpa/org-20171009 did not work either.

The only thing that worked for me was rm ~/.emacs/elpa/org-20171009/*.elc and then restart Emacs.

  • Strange. Frustrating. Glad you found something that worked.
    – amitp
    Oct 15, 2017 at 15:46

The Evaluation of this C code block is disabled. message is produced by org-babel-check-evaluate which in turn calls org-babel-check-confirm-evaluate to do the check. See the doc strings for these functions for details. The latter function checks for :noeval headers and :eval headers with values "no" or "never" or "no-export" or "never-export". In all these cases, the evaluation is disabled.

I would instrument org-babel-check-confirm-evaluate for edebug, and step through it to find out why it is returning nil, and go from there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.