From: Daimrod <firstname.lastname@example.org>
Subject: Re: Org Babel C/C++
Date: Fri, 30 Mar 2012 13:17:00 +0200 [thread overview]
Message-ID: <email@example.com> (raw)
Michael Hannon <firstname.lastname@example.org> writes:
> On Wednesday, March 28, 2012 at 4:01 PM Daimrod wrote:
>> Eric Schulte <email@example.com> writes:
>>> Applied, Thanks!
>>> Daimrod <firstname.lastname@example.org> writes:
>>>> I've made a small patch to ob-C.el so it now includes the current
>>>> directory to the list of directories to be searched for header files.
>>>> Without this, I cannot include a local header file because the
>>>> compilation happens in /tmp and thus gcc or g++ doesn't search for
>>>> header files in the directory I currently work.
>>>> diff --git a/lisp/ob-C.el b/lisp/ob-C.el
>>>> index f1525aa..4f33fc4 100644
>>>> --- a/lisp/ob-C.el
>>>> +++ b/lisp/ob-C.el
>>>> @@ -96,15 +96,14 @@ or `org-babel-execute:C++'."
>>>> (with-temp-file tmp-src-file (insert full-body))
>>>> - (format "%s -o %s %s %s -I
>>>> + (format "%s -o %s %s %s"
>>>> ((equal org-babel-c-variant 'c)
>>>> ((equal org-babel-c-variant 'cpp)
>>>> (org-babel-process-file-name tmp-bin-file)
>>>> (mapconcat 'identity
>>>> (if (listp flags) flags (list flags)) " ")
>>>> - (org-babel-process-file-name tmp-src-file)
>>>> - (file-name-directory (expand-file-name
>> (buffer-file-name)))) ""))))
>>>> + (org-babel-process-file-name tmp-src-file))
>>>> ((lambda (results)
>>>> (if (member "vector" (cdr (assoc :result-params
>> Hum, I'm quite embarrassed, this doesn't work when the block is executed
>> during an export. I didn't track it down yet, but (buffer-file-name)
>> returns nil during the export probably because the buffer changes.
>> A workaround would be to use the :flags header argument though it's a
>> bit tedious because it doesn't seem possible to eval elisp during the
>> #+BEGIN_SRC cpp :flags -I (file-name-directory (buffer-file-name))
> I ran into this problem a few months ago. I don't have the elisp skills to
> patch Org mode, but I found something that worked for me:
> -- Mike
This won't work if you use different directories, you'll have to set the
variable org-babel-C++-compiler every time.
IMHO a good solution would be to be able to specify the directory used
to compile, or maybe I should just use a Makefile.
next prev parent reply other threads:[~2012-03-30 11:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-23 18:12 Org Babel C/C++ Daimrod
2012-03-26 11:39 ` Eric Schulte
2012-03-28 23:01 ` Daimrod
2012-03-29 1:34 ` Michael Hannon
2012-03-30 11:17 ` Daimrod [this message]
2012-03-31 15:47 ` URGENT " Eric Schulte
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).