emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Details of compling and running C++ code from Org-mode?


From: Michael Hannon
Subject: [O] Details of compling and running C++ code from Org-mode?
Date: Sat, 5 Nov 2011 00:44:24 -0700 (PDT)


Greetings.  I'm curious about the process of executing a program that is
compiled from a source block in Org-mode.

Some background: I was playing with some C++ code (a slight generalization of
some code I found in a book).  I wanted to use the "assign" method to
initialize a vector, as:

    vector<int> testVec(5, 0);
    testVec.assign({2, 4, 6, 8, 10});

It turns out that to do this one has to tell g++ (in my case) to use the
latest version of the C++ standard.  I discovered that I could do this via:

    (setq org-babel-C++-compiler "g++ -std=c++0x")

This got me to wondering if there were any similar hooks that relate to
running the program once it's compiled.  I looked through the list of
org-babel* variables, but didn't find anything obvious.

So what does happen when I hit C-c C-c in, say, a cpp source-code block?  The
contents of the file are evidently written to a temporary file, after which
the command specified by org-babel-C++-compiler is run on that file.  The
results of the compilation are stuck some place -- another temporary file, I
suppose.  Then the second, executable file is run and the results collected.
What command runs the file?  Is there any control from Org-mode over this
second stage of the process?

Thanks,

-- Mike



reply via email to

[Prev in Thread] Current Thread [Next in Thread]