[Top][All Lists]

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

[O] org-babel C math.h issue

From: Oz Ben-Ami
Subject: [O] org-babel C math.h issue
Date: Sun, 6 Mar 2016 17:44:26 -0500


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 inserted in the wrong place, before the source file. An easy change would be in line 147 of ob-C.el version 8.3.4-634, moving "flags" to after the source file. This seems to work, but I don't know if it would break anything else.

A minimal working example, attached, includes the following snippet:

#+BEGIN_SRC C :includes '(<math.h> <stdio.h>) :flags -lm
int i=9;

Note the issue disappears if constants are directly used rather than variables, presumably because the function call is optimized away entirely.

Any thoughts are appreciated.


Attachment: testC.org
Description: Binary data

reply via email to

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