Howto compile ROOT libraries with gcc/g++

I’m getting start with ROOT. Now I’m have a problem is that I want compile a program using some ROOT libraries with g++, but it cannot. In fact, I don’t know which libraries need to link in compile command to succeed compiling.

For example, my program is using TH1F and TTree class of ROOT, how can I compile it suceessfully with g++?

Thanks for any help,


you should use ACLiC: in ROOT do “.L MyCode.cxx+” and you can use it: call functions, write objects to ROOT files etc. If you want prefer the rocky ride check test/Makefile for an example. You should alos read the users guide how to add your own classes.