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


From: Eric Schulte
Subject: Re: [O] Problems running C code in org-mode under Windows
Date: Mon, 26 Mar 2012 21:44:55 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux)

Richard Stanton <address@hidden> 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 via email to

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