The title says it all, and I've included the relevant sections of my file below. I'm trying to create a src block that uses some functionality of the boost libraries, the first src block sets up the compiler, including the libraries to link to. The second src block is just a test function, but it quits with a linker error.
#+begin_src elisp :exports results
(setq org-babel-C++-compiler
(concat "g++ -std=c++0x"
" -lboost_system -lboost_filesystem"
" -I"
(expand-file-name ".")
)
)
#+end_src
#+begin_src C++ :exports both :includes (list "\"boost/filesystem.hpp\"" "<stdio.h>")
printf("testing\n");
#+end_src
The error:
/tmp/ccvz9bRM.o: In function
__static_initialization_and_destruction_0(int, int)': C-src-2374gem.cpp:(.text+0x51): undefined reference to
boost::system::generic_category()' C-src-2374gem.cpp:(.text+0x5d): undefined reference toboost::system::generic_category()' C-src-2374gem.cpp:(.text+0x69): undefined reference to
boost::system::system_category()' collect2: error: ld returned 1 exit status /bin/bash: /tmp/babel-2374l5F/C-bin-2374tos: No such file or directory
ld
. Try adding-L/path/to/boost
before-lboost_system
-lboost_system
argument to go after the name of the source file in the compilation command. Looking at the source fororg-babel-C-execute
, there seems to be no provision for doing that. There is a:flags
argument, but that gets put before the source file name. If my understanding is right you will have to hack that function by hand, or send a feature request to the orgmode mailing list.