13

I'm using org-mode V7.8.09. When I was trying to export the following c++ code block to html,

#+begin_src c++
  int a=1;
  int b=1;
  printf("%d\n", a+b);
#+end_src

it failed with message

org-babel-exp processing...
font-lock-fontify-keywords-region: Symbol's value as variable is void: font-lock-end-statement-face`

Interestingly, if I claim that it is python code, it exports successfully...

#+begin_src python
  int a=1;
  int b=1;
  printf("%d\n", a+b);
#+end_src

After I add (org-babel-do-load-languages 'org-babel-load-languages '((C . t))) in my init.el, the error message is gone and c++ codes can be exported to html successfully. But c++ codes are not highlighted, while python codes are highlighted fine.

updogliu
  • 6,066
  • 7
  • 37
  • 50

1 Answers1

4

The package that you need load is emacs/lisp/org/ob-C.el

https://bitbucket.org/nobeira/dot.emacs.d/src/c6af5b1535b1/elisp/org-7.4/lisp/ob-C.el.

there is not C++ package

.emacs.el configuration file:

(org-babel-load-languages (C . t)))
(setq org-src-fontify-natively t)

org document:

#+BEGIN_SRC cpp   :includes <stdio.h> :exports both
 int a=1;
 int b=1;
 printf("%d\n", a+b);
#+END_SRC

for me work (fontify and running) ONLY with cpp source_name

Candido

candido
  • 143
  • 9