You can get the body of the code block as a string by executing the following with point in the source block:
(plist-get (cadr (org-element-at-point)) :value)
You can also expand the body of a source block with C-c C-v C-v (bound to org-babel-expand-src-block) which creates a preview buffer with not only the source code but also the surrounding context (e.g....
You need to arrange that gcc is called with the flag -I . that tells the preprocessor to look in the current directory (as well as the default directories). You can do that with
#+begin_src C :exports both :flags -I .
Why that is needed and why you ...
This is not beautiful, but may work well enough for you.
(defun set-frame-title ()
(format "%s - %s" (buffer-file-name) (org-element-property :language (org-element-context)))
(add-hook 'post-command-hook 'set-frame-title)
if performance is not good, you ...
I usually use #+begin_shell :results drawer which wraps the results in a drawer. You can also use :results raw but that has some disadvantages: Org mode does not know where the results end, so you cannot delete them with org-babel-remove-result.
You can also use a different wrapper, e.g. #+begin_shell :results drawer :wrap example will wrap the results in a
I was able to generate a PNG image of TikZ with the following minimal reproducible example.
In the GIF shown below, you can see that I execute emacs by using the -Q flag and by loading Lisp code present in the main.el file. The image is generated from the file main.org without any problem.
The following code block shows the content of the main.org file
I use #+constants: variable=value for this and then (org-table-get-constant "variable") to get the value for src blocks etc. The advantage is that constants can be used directly in tables with $variable.