emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Richard Stanton <stanton@haas.berkeley.edu>
To: 'Eric Schulte' <eric.schulte@gmx.com>
Cc: "'emacs-orgmode@gnu.org'" <emacs-orgmode@gnu.org>
Subject: Re: Problems running C code in org-mode under Windows - SOLVED
Date: Thu, 29 Mar 2012 10:41:16 -0700	[thread overview]
Message-ID: <40C7B1BFC291ED4E9D10436D07736A334702EB9BB0@EXMAIL7.haas.uc.berkeley.edu> (raw)

> 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	other threads:[~2012-03-29 17:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-29 17:41 Richard Stanton [this message]
2012-03-29 19:18 ` Problems running C code in org-mode under Windows - SOLVED Nick Dokos
  -- strict thread matches above, loose matches on Subject: below --
2012-03-29 17:29 Richard Stanton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40C7B1BFC291ED4E9D10436D07736A334702EB9BB0@EXMAIL7.haas.uc.berkeley.edu \
    --to=stanton@haas.berkeley.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=eric.schulte@gmx.com \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).