Include tree class in a c++ project

Hi,
I would like to add a root tree class into my c++ project. I am using kdevelop for my project. My question is what header files and libraries I need to add into my project. I got lots of linker errors now if I just add tree.h and libtree.so. Thank you very much.

regards,

gma

Hi,
I fixed many errors by adding Core, CINT, NET and RIO library. Now I got few errors in the building:

/home/gma/root/lib/root/libCore.so: undefined reference to `dladdr' /home/gma/root/lib/root/libCint.so: undefined reference to `dlopen' /home/gma/root/lib/root/libCint.so: undefined reference to `dlclose' /home/gma/root/lib/root/libCint.so: undefined reference to ` dlerror' /home/gma/root/lib/root/libCint.so: undefined reference to `dlsym' collect2: ld returned 1 exit status make[2]: Nothing to be done for `all-am'. make[2]: *** [hellotree2] Error 1 make[2]: Target `all' not remade because of errors. make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 *** Exited with status: 2 ***

Does anyone have some clues how to fix them? Thanks.

gma

Add “-ldl” in your link sequence.
see the list of required libs by typing

root-config --libs or better by replacing your list of libs by

`root-config --libs`
see first pages of the Users Guide

Rene

Thanks, Brun. It works. Happy new year!

gma

Now I put a tree class into my project and I want to put my data class into the tree.

I created a data class using ACLIC. I have the header and so files now. When I link my program, I got the following error message

/usr/bin/ld: cannot find -lOTHistData_cpp

But I put the so file path into the linker path. I am wondering how I can solve this problem. Thank you very much.

regards,

gma

The library created by ACLiC is named OTHistData_cpp.so (and it not named libOTHistData_cpp.so) you can not access them via -lOTHistData_cpp.
Instead you would need to explicitly use OTHistData_cpp.so.
You can also add a soft link from OTHistData_cpp.so to libOTHistData_cpp.so.
Or you can use TSystem::CompileMacro (the heart of ACLiC) directly which lets give an explicit name to your library.

Cheers,
Philippe.