From: Thierry Banel <tbanelwebmin@free.fr>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH] org-babel C math.h issue
Date: Sun, 20 Mar 2016 15:03:26 +0100 [thread overview]
Message-ID: <56EEADAE.7090604@free.fr> (raw)
In-Reply-To: <CABYMxKxaExgmjbbv3tCVDWHNJgtT4hw0tg1rU1o-huMmi3ibGg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 765 bytes --]
Attached is Oz's patch adding optional :libs support to Babel C++
Thanks Oz.
Thierry
Le 11/03/2016 20:14, Oz Ben-Ami a écrit :
> 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 see, I would need to add
> the following lines in ob-C.el:
> L133: (libs (cdr (assoc :libs params)))
> (libs (mapconcat 'identity
> (if (listp libs) libs (list libs)) " "))
> L142: (format "%s -o %s %s %s %s" ;; (added %s)
> L147: libs
>
> Am I missing anything?
>
> Oz
>
[-- Attachment #2: 0001-Add-libs-to-babel-C.patch --]
[-- Type: text/x-diff, Size: 1543 bytes --]
From 69661d4406c51f678dad6f14aaa8f3447c398825 Mon Sep 17 00:00:00 2001
From: Thierry Banel <tbanelwebmin@free.fr>
Date: Sun, 20 Mar 2016 14:50:17 +0100
Subject: [PATCH] Add :libs to babel C++
* lisp/ob-C.el (org-babel-C-execute): add support for :libs header
parameter to specify libraries to link with.
---
lisp/ob-C.el | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/lisp/ob-C.el b/lisp/ob-C.el
index dd34b0b..d5855ab 100644
--- a/lisp/ob-C.el
+++ b/lisp/ob-C.el
@@ -130,6 +130,12 @@ or `org-babel-execute:C++' or `org-babel-execute:D'."
(flags (cdr (assoc :flags params)))
(flags (mapconcat 'identity
(if (listp flags) flags (list flags)) " "))
+ (libs (org-babel-read
+ (or (cdr (assoc :libs params))
+ (org-entry-get nil "libs" t))
+ nil))
+ (libs (mapconcat 'identity
+ (if (listp libs) libs (list libs)) " "))
(full-body
(case org-babel-c-variant
(c (org-babel-C-expand-C body params))
@@ -139,13 +145,15 @@ or `org-babel-execute:C++' or `org-babel-execute:D'."
(case org-babel-c-variant
((c cpp)
(org-babel-eval
- (format "%s -o %s %s %s"
+ (format "%s -o %s %s %s %s"
(case org-babel-c-variant
(c org-babel-C-compiler)
(cpp org-babel-C++-compiler))
(org-babel-process-file-name tmp-bin-file)
flags
- (org-babel-process-file-name tmp-src-file)) ""))
+ (org-babel-process-file-name tmp-src-file)
+ libs)
+ ""))
(d nil)) ;; no separate compilation for D
(let ((results
(org-babel-eval
--
2.1.4
next prev parent reply other threads:[~2016-03-20 14:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-06 22:44 org-babel C math.h issue Oz Ben-Ami
2016-03-10 9:43 ` Nicolas Goaziou
2016-03-10 14:06 ` Anssi Saari
2016-03-10 15:20 ` John Kitchin
2016-03-10 21:19 ` Nick Dokos
2016-03-11 6:44 ` Anssi Saari
2016-03-11 15:36 ` Nick Dokos
2016-03-11 18:52 ` Thierry Banel
2016-03-11 19:14 ` Oz Ben-Ami
2016-03-11 23:14 ` Thierry Banel
2016-03-20 14:03 ` Thierry Banel [this message]
2016-03-25 23:42 ` [PATCH] " Nicolas Goaziou
2016-03-26 17:08 ` Thierry Banel
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56EEADAE.7090604@free.fr \
--to=tbanelwebmin@free.fr \
--cc=emacs-orgmode@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.