Makefile of simple analysis

Hi evryone
I try to run my analysis with a simple makefile but until now i can’t run it correctly .
you wil find below the files
could you please help me

CXX=$(shell root-config --cxx)
CXXFLAGS=$(shell root-config --cflags)
LDFLAGS=$(shell root-config --ldflags)
LDLIBS= $(shell root-config --glibs)

LIBS=analyse2.so
SOURCES=analyse2.cc 
OBJECTS=$(SOURCES:.cc=.o)
EXECUTABLE=t1

$(EXECUTABLE): $(OBJECTS)
	$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)

$(OBJECTS) : $(SOURCES) analyse2.h
        $(CXX) $(CXXFLAGS) -W -Wall -c -fpic $< -o $@ 

clean:
	rm ./~ ./.o

and this is the error a got:

c++ -pthread -std=c++11 -m64 -I/home/ahmed/myprograms/root/include -W -Wall -c -fpic analyse2.cc -o analyse2.o 
In file included from analyse2.cc:4:0:
analyse2.h:265:30: warning: unused parameter ‘entry’ [-Wunused-parameter]
 Int_t analyse2::Cut(Long64_t entry)
                              ^
c++ -m64 -o t1 analyse2.o -L/home/ahmed/myprograms/root/lib -lGui -lCore -lImt -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lROOTVecOps -lTree -lTreePlayer -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -lROOTDataFrame -pthread -lm -ldl -rdynamic
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
Makefile:28: recipe for target 't1' failed
make: *** [t1] Error 1

analyse2.cc (1.5 KB) analyse2.h (7.9 KB)
thanks

Hi,
as the error says, there is no main function in analyse2.cc. The compiler does not know how to create an executable from just analyse2.{cc,h}, you need a main function somewhere, as an entry point for the executable.

Hope this helps!
Enrico

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.