I am trying to compile a Root script externally with g++ so as to make a stand alone executable. As an initial step I am trying to just compile (main.cc):
#include "TTree.h"
int main()
{
return 0;
}
However I get the following error that I can’t figure out:
g++ -c -g -Wall root-config --cflagsmain.cc -o main.o
g++ root-config --glibs main.o -o main
main.o: In function __static_initialization_and_destruction_0': /usr/local/include/root/TVersionCheck.h:34: undefined reference toTVersionCheck::TVersionCheck(int)'
collect2: ld returned 1 exit status
make: *** [main] Error 1
I don’t think I have any previous installs. This is what is in the LD_LIBRARY_PATH
$ echo $LD_LIBRARY_PATH
/home/sam/geant4.9.5.p01-install/lib:/home/sam/geant4.9.5.p01-install/lib:/usr/local/lib/root
When I try to compile with out make:
g++ root-config --ldflags -o main main.ccroot-config --glibs
main.cc:2:19: fatal error: TTree.h: No such file or directory
compilation terminated.