This code compiles fine on command line but org-babel can't link it.
#+BEGIN_SRC C++ :flags "-std=c++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 = a*x+b*y==3, x-y==b;
vars = x, y;
cout << lsolve(eqns, vars) << endl;
// -> {x==(3+b^2)/(b+a),y==(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::symbol(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'