Compiling and Makefile

Dear experts,

I’ve been trying to write a Makefile which compiles a code I have - the code is something generated by makeclass in root. I then have a separate code called runAnalysis.C that basically runs the makeclass (bprimeplots.C/.h) on a specific root file.

I’ve been trying to write a Makefile to compile this code properly but I’ve gotten myself a little confused and I’m very unfamiliar with makefiles in general - so mine could be entirely wrong. The makefile I’m using is attached at the bottom. So I’m trying to make a makefile that can compiles both the runAnalysis and the makeclass code, so that I can run one command on it (say ./run).

The error I get is:
mydict.cc:55: undefined reference to typeinfo for bprimeplots' /tmp/cccmBVsr.o: In functionbprimeplots’:
bprimeplots.h:1266: undefined reference to `vtable for bprimeplots’
collect2: ld returned 1 exit status

I’ve read that these errors may originate from defining virtual functions incorrectly in the makeclass code but I’ve not been successful yet.

Any help would be very much appreciated!
Cheers,
Mike


CXX = g++
CXXFLAGS = $(OPT2) -m32 -pipe -Wall -W -Woverloaded-virtual -g
LD = g++
LDFLAGS = $(OPT2) -m32 -bind_at_load
SOFLAGS = -dynamiclib -single_module -undefined $(UNDEFOPT)

ROOTINCLUDES = -I$(CMS_PATH)/slc5_ia32_gcc434/lcg/root/5.22.00d-cms19/include
ROOTLDLIBS = -L$(CMS_PATH)/slc5_ia32_gcc434/lcg/root/5.22.00d-cms19/lib -lPhysics -lEG -lMathCore -lHist -lTree -lCore -lNet -lRIO

INCLUDES = $(ROOTINCLUDES)
LDLIBS = -L. $(ROOTLDLIBS)

run: runAnalysis.o bprimeplots.o
$(LD) $(LDFLAGS) -o run

bprimeplots.o : bprimeplots.C bprimeplots.h mydict.cc
$(CXX) $(CXXFLAGS) $(INCLUDES) $(LDFLAGS) $^ $(LDLIBS)

runAnalysis.o : runAnalysis.C mydict.cc
$(CXX) $(CXXFLAGS) $(INCLUDES) $(LDFLAGS) $^ $(LDLIBS)

mydict.cc :
rootcint -f mydict.cc -c bprimeplots.h LinkDef.h

It looks like you are not compiling not linking the dictionary file (mydict.cc)

Philippe.