From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Hannon Subject: Re: Problem compiling C++ in Org-mode Date: Fri, 18 Nov 2011 00:39:44 -0800 (PST) Message-ID: <1321605584.56574.YahooMailNeo@web161909.mail.bf1.yahoo.com> References: <1321592202.64015.YahooMailNeo@web161913.mail.bf1.yahoo.com> <87wraxanis.fsf@avasys.jp> 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 ([140.186.70.92]:48100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RRJz8-0002KP-Jd for emacs-orgmode@gnu.org; Fri, 18 Nov 2011 03:39:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RRJz7-0000QJ-Lt for emacs-orgmode@gnu.org; Fri, 18 Nov 2011 03:39:46 -0500 Received: from nm38-vm6.bullet.mail.bf1.yahoo.com ([72.30.239.22]:22162) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1RRJz7-0000Q9-DA for emacs-orgmode@gnu.org; Fri, 18 Nov 2011 03:39:45 -0500 In-Reply-To: <87wraxanis.fsf@avasys.jp> 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: Olaf Meeuwissen Cc: Org-Mode List Olaf Meeuwissen wrote:=0A=0A>=A0 Michael Hannon write= s:=0A=0A>> Greetings.=A0 I'm having a problem compiling a C++ source-code b= lock in=0A>> Org-mode.=A0 The same C++ code compiles and runs in the shell.= =0A>>=0A>> The issue seems to relate to local include files.=A0 [...snip...= ]=0A>> What am I missing?=0A>=0A>> /tmp/babel-245846_d/C-src-24584NIQ.cpp:7= :26: fatal error: OtherStuff.cpp: No=0A>> such file or directory=0A>> compi= lation terminated.=0A>> /bin/bash: /tmp/babel-245846_d/C-bin-24584aSW: Perm= ission denied=0A=0A> Compilation is taking place in a temporary directory, = miles away from=0A> where your org file lives.=0A=0A>> ########## Org-mode = compile uses same option as shell compile:=0A>>=0A>> org-babel-C++-compiler= is a variable defined in `ob-C.el'.=0A>> Its value is "g++ -std=3Dc++0x"= =0A=0A> The current directory is not specified in the include path.=A0 You = would=0A> need to add a -I option to set the (absolute path to the) directo= ry the=0A> org file is in.=A0 If you have all your org files in ~/org, you = could try=0A> "g++ -std=3Dc++0x -I~/org".=0A=0AThanks, Olaf.=A0 That does f= ix the problem, and in some sense that's the obvious=0Asolution.=A0 On the = other hand, it does seem strange to me that the end user=0Ashould have to s= pecify the include directory.=A0 I.e., Emacs clearly knows the=0Acurrent di= rectory ("M-x pwd", for instance), and the C++ compiler "knows" to=0Alook i= n the current directory for include files enclosed in quote marks.=A0 I=0Aa= ssumed that the compilation process in Org-mode would include steps similar= =0Ato:=0A=0A=A0=A0=A0 + remember current directory=0A=A0=A0=A0 + write cont= ents of source block to obscure location in /tmp=0A=A0=A0=A0 + compile sour= ce block in obscure location,=0A=A0=A0=A0=A0=A0=A0=A0=A0=A0 but remembering= the starting directory for such things=0A=A0=A0=A0=A0=A0=A0=A0=A0=A0 as in= clude files=0A=0AObviously I was wrong, but it still seems a reasonable app= roach.=0A=0A-- Mike