From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Stanton Subject: Re: Problems running C code in org-mode under Windows - SOLVED Date: Thu, 29 Mar 2012 10:41:16 -0700 Message-ID: <40C7B1BFC291ED4E9D10436D07736A334702EB9BB0@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]:39819) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDJLn-0005Bq-FP for emacs-orgmode@gnu.org; Thu, 29 Mar 2012 13:41:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SDJLi-0007RO-Dl for emacs-orgmode@gnu.org; Thu, 29 Mar 2012 13:41:31 -0400 Received: from gateway-b.haas.berkeley.edu ([128.32.222.40]:45900) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDJLi-0007R2-7T for emacs-orgmode@gnu.org; Thu, 29 Mar 2012 13:41:26 -0400 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'" > To allow for people who might be using the Cygwin bash shell in Emacs > under Windows (which is recommended by many), I do recommend making > the change I suggested above, adding the following lines to ob-C.el: >=20 > > (tmp-bin-file (org-babel-temp-file > > "C-bin-" > > (if (equal system-type 'windows-nt) ".exe" ""))) > > >=20 > This prevents bash trying to run an (empty) file with no extension when t= he > compiler has generated a file with a ".exe" extension. Otherwise, it look= s > like I now have this running fine. >=20 > I also suggest not creating an empty binary file and just letting the com= piler > create it, unless this poses some risks I'm not seeing. One more quick follow-up: It seems that I need to add a "return(0);" line t= o my main routine to get any C examples to work under Windows, whereas I do= n't need to add such a line on my Mac. I just tried the cocktail.c example = from your 2012 Journal of Statistical Software article, and this works on m= y Mac, but fails on my PC (even with my edits to ob-C.el) unless I add "ret= urn(0);" at the end of the main code block.=20 It would be nice for Windows users to be able to run others' examples witho= ut having to edit them first, so what do you think of the idea of having o= b-C.el append a "return(0);" line to the main file before passing it to the= compiler?=20