emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Problems running C code in org-mode under Windows - SOLVED


From: Richard Stanton
Subject: Re: [O] Problems running C code in org-mode under Windows - SOLVED
Date: Thu, 29 Mar 2012 10:41:16 -0700

> 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:
> 
> >          (tmp-bin-file (org-babel-temp-file
> >                     "C-bin-"
> >                     (if (equal system-type 'windows-nt) ".exe" "")))
> >
> 
> This prevents bash trying to run an (empty) file with no extension when the
> compiler has generated a file with a ".exe" extension. Otherwise, it looks
> like I now have this running fine.
> 
> I also suggest not creating an empty binary file and just letting the compiler
> 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 to my 
main routine to get any C examples to work under Windows, whereas I don'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 my Mac, but 
fails on my PC (even with my edits to ob-C.el) unless I add "return(0);" at the 
end of the main code block. 

It would be nice for Windows users to be able to run others' examples without 
having to edit them first, so what do you think of the idea of having  ob-C.el 
append a "return(0);" line to the main file before passing it to the compiler? 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]