emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <eric.schulte@gmx.com>
To: Richard Stanton <stanton@haas.berkeley.edu>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Problems running C code in org-mode under Windows
Date: Mon, 26 Mar 2012 21:44:55 -0400	[thread overview]
Message-ID: <87bonikeaw.fsf@gmx.com> (raw)
In-Reply-To: <40C7B1BFC291ED4E9D10436D07736A334702B60A32@EXMAIL7.haas.uc.berkeley.edu> (Richard Stanton's message of "Mon, 26 Mar 2012 16:04:58 -0700")

Richard Stanton <stanton@haas.berkeley.edu> writes:

> Here's a simple org file that's supposed to run some C code and print the result:
>
> ----------------------
>
> * Sample C code
>
> #+name: RHS.c
> #+begin_src C :noweb yes :tangle RHS.c
>   #include <stdio.h>
>   <<main>>
> #+end_src
>
> #+name: main
> #+begin_src C
>   int main(int argc, char *argv[]) {
>     int lst[argc-1];
>     int i;
>     for(i=1;i<argc;i++)
>       lst[i-1] = atoi(argv[i]);
>     for(i=1;i<argc;i++)
>       printf("%d ", lst[i-1] + 1);
>     printf("\n");
> }
> #+end_src
>
> #+call: RHS.c[:cmdline 8 7 6]()
>
> -------------------------
>
> It works fine on my Mac, producing the result:
>
> #+RESULTS: RHS.c[:cmdline 8 7 6]()
> : 9 8 7
>
> On my PC, however, running Windows Vista, the output is blank and
> there's a *Org-babel-error-output* buffer containing the message
>
> Access is denied.
> 'c:/Users/stanton/AppData/Local/Temp/babel-11948MQP/C-bin-11948Nln' is
> not recognized as an internal or external command,
> operable program or batch file.
>
> There is a file called C-bin-11948Nln in that directory, but it has
> length 0, suggesting that something is going wrong in the compilation
> process. However, I can also see potential problems with the fact that
> the file name does not end in .exe, so the Windows shell is not easily
> going to recognize it as an executable anyway.
>
> Does anyone have this running OK under Windows? Alternatively, how can
> I track down what's going wrong in more detail?
>
> Thanks.
>
> Richard Stanton
>

I don't have access to a windows machine so I can't debug this myself,
but I would suggest stepping through the execution of the
`org-babel-C-execute' function using edebug.  This is done by first
placing the cursor inside the `org-babel-C-execute' function, evaluating
the function with C-u C-M-x, then executing a C code block.  This should
give you some idea of what is going wrong where.

Best,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

  reply	other threads:[~2012-03-27  3:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-26 23:04 Problems running C code in org-mode under Windows Richard Stanton
2012-03-27  1:44 ` Eric Schulte [this message]
2012-03-27 17:25   ` Richard Stanton
2012-03-27 16:06     ` Eric Schulte
2012-03-27 20:43       ` Richard Stanton
     [not found]       ` <0B0951AC10878A45A228603F57EEA0CE46F5DD0CBF@EXMAIL7.haas.uc.berkeley.edu>
2012-03-28  6:00         ` Richard Stanton
2012-03-28  7:14       ` 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  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=87bonikeaw.fsf@gmx.com \
    --to=eric.schulte@gmx.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=stanton@haas.berkeley.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).