From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Stanton Subject: Re: Problems running C code in org-mode under Windows Date: Tue, 27 Mar 2012 23:00:39 -0700 Message-ID: <40C7B1BFC291ED4E9D10436D07736A334702EB9999@EXMAIL7.haas.uc.berkeley.edu> References: <40C7B1BFC291ED4E9D10436D07736A334702B60A32@EXMAIL7.haas.uc.berkeley.edu> <87bonikeaw.fsf@gmx.com> <40C7B1BFC291ED4E9D10436D07736A334702B60B3A@EXMAIL7.haas.uc.berkeley.edu> <87r4wec9lg.fsf@gmx.com> <0B0951AC10878A45A228603F57EEA0CE46F5DD0CBF@EXMAIL7.haas.uc.berkeley.edu> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:50121) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SClw6-0007Cv-AH for emacs-orgmode@gnu.org; Wed, 28 Mar 2012 02:00:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SClw4-0008CN-1p for emacs-orgmode@gnu.org; Wed, 28 Mar 2012 02:00:45 -0400 Received: from gateway-b.haas.berkeley.edu ([128.32.222.40]:65259) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SClw3-0008Bm-SZ for emacs-orgmode@gnu.org; Wed, 28 Mar 2012 02:00:43 -0400 In-Reply-To: <0B0951AC10878A45A228603F57EEA0CE46F5DD0CBF@EXMAIL7.haas.uc.berkeley.edu> Content-Language: en-US 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: 'Eric Schulte' Cc: "'emacs-orgmode@gnu.org'" > I think the "Access is denied" problem is probably the same as that liste= d > here: >=20 > http://lists.gnu.org/archive/html/help-gnu-emacs/2010-04/msg00247.html >=20 > Unfortunately, when I switch to using bash as my shell under Windows, thi= s > causes problems with python-mode (though this is not really your > problem...) This change does get the compilation to work on my machine, > however, and a .exe file is created. So far so good... >=20 > However, the output still appears blank in the org buffer. More tracing > required... One problem - when using bash as the shell, when trying to execute the comp= iled file, it tries to execute the empty file, not the file that was just c= ompiled (which has the same name, but the extension .exe, added by the comp= iler).=20 A partial solution to this is to append ".exe" to the name of the binary te= mp file if running under Windows. E.g., start org-babel-C-execute something= like this: (defun org-babel-C-execute (body params) "This function should only be called by `org-babel-execute:C' or `org-babel-execute:C++'." (let* ((tmp-src-file (org-babel-temp-file "C-src-" (cond ((equal org-babel-c-variant 'c) ".c") ((equal org-babel-c-variant 'cpp) ".cpp")))) (tmp-bin-file (org-babel-temp-file=20 "C-bin-" (if (equal system-type 'windows-nt) ".exe" ""))) [...] I say "partial solution" because the output in the org file is *still* blan= k, but at least the program does get run this way... One question - why create a temp file for the executable before running the= compilation? Why not just have it created by the compiler?