Makefile with ROOT libraries

First time I write on this forum but used it quite a lot in the past (thanks you for its existence :smiley:)

I’m writing a stand alone program that required ROOT libraries to work on TFiles.
The first part that uses just c++ functions worked very well and I haven’t any problem with make command.
When I add a function that required TFiles.h and “TTree.h” (but also just adding the corrispective #inlcude in the header) it stop working.

This is the error message after doing make on terminal

g++ -L /usr/include/boost root-config --glibs -o CSEXE ConfigFile.o CS.o Sorter.o SortRun.o -lboost_system -lboost_filesystem -lboost_thread
CS.o: In function __static_initialization_and_destruction_0': /gate/root/include/TVersionCheck.h:34: undefined reference toTVersionCheck::TVersionCheck(int)‘
Sorter.o: In function __static_initialization_and_destruction_0': /gate/root/include/TVersionCheck.h:34: undefined reference toTVersionCheck::TVersionCheck(int)’

This is my makefile:

CXXFLAGS += -I /usr/include/boost root-config --cflags
LDFLAGS += -L /usr/include/boost root-config --glibs
CPPFLAGS += -MD -MP -ansi -pedantic -Wall -g

SOURCES := $(wildcard *.cc)

$(CXX) $(LDFLAGS) -o $@ $^ -lboost_system -lboost_filesystem -lboost_thread
rm -rf *.d *.o
-include $(

rm -rf *EXE *.d *.o

Some information:
I always do the source of the .sh file in the root folder.

Everything works properly when I compile my single file programs with:
g++ -Wall -ansi myfile.cxx -o myfileEXE root-config --cflags --glibs

Reading somewhere on the forum I have done a check (I don’t know if it is usefull): writing root-config --glibs on terminal I obtain this error
-bash: -L/gate/root/lib: No such file or directory

instead of the list of classes.

I ask for your help because I’m very newbie on makefile and all that stuff :slight_smile:

Try with:
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) -lboost_system -lboost_filesystem -lboost_thread
See also: [url]Compiling Root script with g++

Thank you!!! It worked!
As I tought I messed up with the makefile!

Thanks again!