Compiling C++ file that includes boost library

Hi,

I have boost library on my OSX, how do I tell ROOT to link to boost library when running C++ file on root?

Regards,
Ramiel

Hi,

Any class/function that relied on boost must be compiled (possibly via ACLiC) as the interpreter can not parse a large fraction of the boost code. To use the boost library you need to tell ROOT/ACLiC where the header file are:gSystem->AddIncludePath("-I where_boost_is/include");and load the libraries (if any)gSystem->Load("where_boost_is/lib/libBoostABC");

Cheers,
Philippe.

Hello,

I put my boost in /Users/phxtn/CppLibrary/.
In my RootMacro.cc, I do #include <boost/math/tr1.hpp>
(I just want to use gamma function. I am not sure if this is the right way to do it.)

On ROOT, I do:
gSystem->AddIncludePath("-I /Users/phxtn/CppLibrary");
When I run the macro using command:
.x RootMacro.cc
it says
Error: cannot open file “boost/math/tr1.hpp” RootMacro.cc:18:
*** Interpreter error recovered ***

When I try:
gSystem->Load("/Users/phxtn/CppLibrary/boost/math/");
the error message is:
Error in TString::AssertElement: out of bounds: i = -1, Length = 0
Error in TUnixSystem::DynamicPathName: /Users/phxtn/CppLibrary/boost/math/
[.so | .sl | .dl | .a | .dll] does not exist in /Applications/root//lib:/Applications/root//lib::
/Applications/root//lib::.:/Applications/root/lib::/Applications/root/cint/cint/stl

Please help,
Ramiel

Hi,

[quote](I just want to use gamma function. I am not sure if this is the right way to do it.)
[/quote]Hummm … Wouldn’t it be simpler to use the TMath::Gamma function?

[quote]Error: cannot open file “boost/math/tr1.hpp” RootMacro.cc:18:
*** Interpreter error recovered ***[/quote]
As CINT can not handle most of BOOST I did not give the prescription for interpreter script to be able to include boost header file (which would be to type .include /Users/phxtn/CppLibrary).

[quote]When I run the macro using command:
.x RootMacro.cc[/quote]I recommend compiling via ACLiC:.x RootMacro.cc+

[quote]gSystem->Load("/Users/phxtn/CppLibrary/boost/math/");[/quote]Humm … What is the name of the shared library file you are trying to load? Giving a directory name to gSystem->Load won’t work.

Cheers,
Philippe.