From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Hannon Subject: Re: Org Babel C/C++ Date: Wed, 28 Mar 2012 18:34:28 -0700 (PDT) Message-ID: <1332984868.16913.YahooMailNeo@web161902.mail.bf1.yahoo.com> References: <87fwcz6vbf.fsf@gmail.com> <87wr67po1v.fsf@gmx.com> <87zkb0qqj0.fsf@gmail.com> Reply-To: Michael Hannon Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:43217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SD4G3-0007Xs-07 for emacs-orgmode@gnu.org; Wed, 28 Mar 2012 21:34:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SD4Fz-0006Hs-1M for emacs-orgmode@gnu.org; Wed, 28 Mar 2012 21:34:34 -0400 Received: from nm25.bullet.mail.bf1.yahoo.com ([98.139.212.184]:21412) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1SD4Fy-0006Hb-QL for emacs-orgmode@gnu.org; Wed, 28 Mar 2012 21:34:30 -0400 In-Reply-To: <87zkb0qqj0.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Daimrod , "emacs-orgmode@gnu.org" On Wednesday, March 28, 2012 at 4:01 PM Daimrod wrote:=0A=0A> Eric Schulte = writes:=0A>=0A>> Applied, Thanks!=0A>>=0A>> Daimrod = writes:=0A>>=0A>>> Hi,=0A>>>=0A>>> I've made a small pa= tch to ob-C.el so it now includes the current=0A>>> directory to the list o= f directories to be searched for header files.=0A>>> Without this, I cannot= include a local header file because the=0A>>> compilation happens in /tmp = and thus gcc or g++ doesn't search for=0A>>> header files in the directory = I currently work.=0A>>>=0A>>> diff --git a/lisp/ob-C.el b/lisp/ob-C.el=0A>>= > index f1525aa..4f33fc4 100644=0A>>> --- a/lisp/ob-C.el=0A>>> +++ b/lisp/o= b-C.el=0A>>> @@ -96,15 +96,14 @@ or `org-babel-execute:C++'."=0A>>>=A0=A0= =A0=A0=A0=A0=A0=A0 (progn=0A>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (with-temp-fi= le tmp-src-file (insert full-body))=0A>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (or= g-babel-eval=0A>>> -=A0=A0=A0=A0=A0=A0=A0 (format "%s -o %s %s %s -I=0A> \"= %s\""=0A>>> +=A0=A0=A0=A0=A0=A0=A0 (format "%s -o %s %s %s"=0A>>>=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (cond=0A>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 ((equal org-babel-c-variant 'c)=0A> org-babel-C-compiler= )=0A>>>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ((equal org-babel-c= -variant 'cpp)=0A> org-babel-C++-compiler))=0A>>>=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 (org-babel-process-file-name tmp-bin-file)=0A>>>=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (mapconcat 'identity=0A>>>=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (if (listp flags) flags (list fl= ags)) " ")=0A>>> -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (org-babel-process-file= -name tmp-src-file)=0A>>> -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (file-name-dir= ectory (expand-file-name=0A> (buffer-file-name)))) ""))))=0A>>> +=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 (org-babel-process-file-name tmp-src-file))=0A> ""= ))))=0A>>>=A0=A0=A0=A0=A0=A0 ((lambda (results)=0A>>>=A0=A0=A0=A0=A0=A0=A0= =A0 (org-babel-reassemble-table=0A>>>=A0=A0=A0=A0=A0=A0 (if (member "vector= " (cdr (assoc :result-params=0A> params)))=0A>=0A> Hum, I'm quite embarrass= ed, this doesn't work when the block is executed=0A> during an export. I di= dn't track it down yet, but (buffer-file-name)=0A> returns nil during the e= xport probably because the buffer changes.=0A>=0A> A workaround would be to= use the :flags header argument though it's a=0A> bit tedious because it do= esn't seem possible to eval elisp during the=0A> export.=0A>=0A> i.e.=0A>= =0A> #+BEGIN_SRC cpp :flags -I (file-name-directory (buffer-file-name))=0A>= ...=0A> #+END_SRC=0A>=0A=0AI ran into this problem a few months ago.=A0 I = don't have the elisp skills to=0Apatch Org mode, but I found something that= worked for me:=0A=0A=A0=A0=A0 http://article.gmane.org/gmane.emacs.orgmode= /49356/=0A=0A-- Mike