Re: [O] org-babel C math.h issue

2016-03-11 Thread Thierry Banel
Seems good. I tested it. As a refinement, the associated documentation should be updated (but that is a separate patch). http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-C.html Thierry Le 11/03/2016 20:14, Oz Ben-Ami a éc

Re: [O] org-babel C math.h issue

2016-03-11 Thread Oz Ben-Ami
Thanks for the response. On my machine, I get the undefined references even with GCC 5 (gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2)), if I put -lm before the source file name. As far as a patch, I can try but this would be my first time really playing with org-mode code. As far as I can s

Re: [O] org-babel C math.h issue

2016-03-11 Thread Thierry Banel
To summarize this thread: It seems there was an issue long ago. Version 5 of GCC magically fixed it. But it is still here for older compilers. - To debug, execute the following piece of lisp code: (defadvice org-babel-eval (before xxx (cmd body)) "" (messa

Re: [O] org-babel C math.h issue

2016-03-11 Thread Nick Dokos
Anssi Saari writes: > Nick Dokos writes: > >> You can test that that's the case: put your program into a file, say foo.c, >> and >> execute >> >> gcc -o foo.out -lm foo.c >> >> Does that give you undefined references? > > Does for me. gcc --version says > gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8

Re: [O] org-babel C math.h issue

2016-03-10 Thread Anssi Saari
Nick Dokos writes: > You can test that that's the case: put your program into a file, say foo.c, > and > execute > > gcc -o foo.out -lm foo.c > > Does that give you undefined references? Does for me. gcc --version says gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4 So is it gcc that has changed the

Re: [O] org-babel C math.h issue

2016-03-10 Thread Nick Dokos
Oz Ben-Ami writes: > Hi, > > I'm a new org user, and I'm sorry if I'm missing something obvious. When > executing a C code snippet with > org-babel, that contains a math function, I get the famous "undefined > reference" errors. I tried adding > ":flags -lm", but that doesn't help. Looking at t

Re: [O] org-babel C math.h issue

2016-03-10 Thread John Kitchin
I get the right answer on a Mac with org-mode version 8.2.10 Anssi Saari writes: > Oz Ben-Ami writes: > >> A minimal working example, attached, includes the following snippet: >> >> #+BEGIN_SRC C :includes '( ) :flags -lm >> int i=9; >> printf("%d\n",(int)sqrt(i)); >> #+END_SRC > > I get the sa

Re: [O] org-babel C math.h issue

2016-03-10 Thread Anssi Saari
Oz Ben-Ami writes: > A minimal working example, attached, includes the following snippet: > > #+BEGIN_SRC C :includes '( ) :flags -lm > int i=9; > printf("%d\n",(int)sqrt(i)); > #+END_SRC I get the same problem, Ubuntu 14.04.3 LTS, GNU Emacs 24.3.1, Org-mode version 8.2.10. So maybe it got fixed

Re: [O] org-babel C math.h issue

2016-03-10 Thread Nicolas Goaziou
Hello, Oz Ben-Ami writes: > A minimal working example, attached, includes the following snippet: > > #+BEGIN_SRC C :includes '( ) :flags -lm > int i=9; > printf("%d\n",(int)sqrt(i)); > #+END_SRC FWIW, I get #+BEGIN_SRC C :includes '( ) :flags -lm int i=9; printf("%d\n",(int)sqrt(i)); #

[O] org-babel C math.h issue

2016-03-06 Thread Oz Ben-Ami
Hi, I'm a new org user, and I'm sorry if I'm missing something obvious. When executing a C code snippet with org-babel, that contains a math function, I get the famous "undefined reference" errors. I tried adding ":flags -lm", but that doesn't help. Looking at the code, it seems the -lm flag is in