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!");
#+end_src
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).
org-babel-load-languages
. Double-check thatActivated
is reallyon
forC
! Is the value oforg-babel-C-compiler
meaningful on your system?(eval org-babel-C-compiler)
givesgcc
. I'm not sure whatActivated
is?(eval org-babel-load-languages)
givesInvalid function: (C . t)
.*.elc
and byte-compiling the sources does the trick.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 :(