From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Banel Subject: Re: C++ code block not linked Date: Mon, 27 Nov 2017 08:33:16 +0100 Message-ID: <5A1BBFBC.2080203@free.fr> References: <5A198E84.5070305@free.fr> Mime-Version: 1.0 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43545) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eJDut-00066S-OU for emacs-orgmode@gnu.org; Mon, 27 Nov 2017 02:33:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eJDup-0006cp-K8 for emacs-orgmode@gnu.org; Mon, 27 Nov 2017 02:33:23 -0500 Received: from smtp6-g21.free.fr ([212.27.42.6]:18078) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eJDup-0006cK-Df for emacs-orgmode@gnu.org; Mon, 27 Nov 2017 02:33:19 -0500 Received: from [IPv6:2a01:e35:2e21:def0:c011:71c1:2bba:7e34] (unknown [IPv6:2a01:e35:2e21:def0:c011:71c1:2bba:7e34]) by smtp6-g21.free.fr (Postfix) with ESMTP id A573878035D for ; Mon, 27 Nov 2017 08:33:16 +0100 (CET) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org
On 26/11/2017 12:42, Roger Mason wrote= :
Hello,

Thierry Banel <tbanelwebmin@free.fr> writes:

On 25/11/2017 15:59, Roger Mason wrote:
This code compiles fine on command line but org-=
babel can't link it.

#+BEGIN_SRC C++ :flags "-std=3Dc++11 -I/usr/local/include" :libs  "-L/usr=
/local/lib -lginac"
#include <iostream>
#include <ginac/ginac.h>
using namespace std;
using namespace GiNaC;

int main () {
     symbol a("a"), b("b"), x("x"), y("y");
     lst eqns, vars;
     eqns =3D a*x+b*y=3D=3D3, x-y=3D=3Db;
     vars =3D x, y;
     cout << lsolve(eqns, vars) << endl;
      // -> {x=3D=3D(3+b^2)/(b+a),y=3D=3D(3-b*a)/(b+a)

return 0;
}
#+END_SRC

The error buffer contains many lines like this:

/tmp//ccv5YYn1.o: In function `main':
C-src-1046xti.cpp:(.text+0x67): undefined reference to `GiNaC::symbol::sy=
mbol(std::__cxx11::basic_string<char, std::char_traits<char>, st=
d::allocator<char> > const&)'

I get the correct result:

#+RESULTS:
| {x=3D=3D(3+b^2)*(a+b)^(-1) | y=3D=3D-(-3+a*b)*(a+b)^(-1)} |

I use Or mode version 9.1.1
I just upgraded to Org mode version 9.1.3 (release_9.1.3-185-g579fa1 @
/home/rmason/.emacs.d/org-git/lisp/) and I'm still getting the link
error.

Cheers,
Roger



You may try to mimic org-babel in a shell, and see what happens.

cd /tmp/babel-29466ws7
g++ -std=3Dc++11 -I/usr/local/include=A0 C-src-29466moy.cpp -L/usr/local/lib -lginac

(of course you need to change the random names like babel-2946= 6ws7 by the actual ones as generated on your system).