Custom class not deriving from TObject

Hi ! I would like to create a class deriving from TSelector (for a PAR archive) and create a libMySelectorLIB.so

I get the following error message :

dlopen error: ./libMySelectorLIB.so: undefined symbol: _ZTI9TSelector Load Error: Failed to load Dynamic link library ./libMySelectorLIB.so

Here is the makefile, LIBUIUC = path to the headers and an other library .so, used by MySelector !

[code]#

Name of the library

LIBNAME = MySelectorLIB

Add your classes here (Don’t forget to recompile the library!)

SOURCES = MySelector.cc

DO NOT MODIFY AFTER THAT, IF YOU DON’T KNOW HOW IT WORKS :slight_smile:

Makefile Root with dictionnary

CINT = rootcint
ARCH = $(shell root-config --arch)

Linux with egcs

CXX = g++
CXXFLAGS = -g -O -Wall -fPIC -Wno-deprecated

ROOTFLAGS += $(shell root-config --cflags)
ROOTLIBS += $(shell root-config --libs)

Include UIUC Library

UIUCFLAGS = -I$(LIBUIUC) -L$(LIBUIUC) -lUIUC

For MAC OSX user only

ifeq ($(ARCH),macosx64)
SOFLAGS = -dynamiclib -single_module -undefined dynamic_lookup
else
SOFLAGS = -shared
endif

#------------------------------------------------------------------------------

LINKDEF = $(LIBNAME).LinkDef.h
DICT = Dictionary.cxx
HEADERS = $(SOURCES:.cc=.h)
OBJS = $(SOURCES:.cc=.o)

lib$(LIBNAME).so: $(DICT) $(OBJS)
@echo -ne "\tCreating library $(LIBNAME)… “
@$(CXX) $(ROOTFLAGS) $(CXXFLAGS) $(SOFLAGS) $(UIUCFLAGS) -o$@ $^
@echo " done”

$(DICT): $(HEADERS) $(LINKDEF)
@echo -ne "\tGenerating dictionary… “
@$(CINT) -f $@ -c $(CXXFLAGS) -I$(LIBUIUC) -p $^
@echo " done”

%.o:%.cc %.h
@echo -ne "\tGenerating object $(basename $(basename $@))… “
@$(CXX) $(CXXFLAGS) $(ROOTFLAGS) $(UIUCFLAGS) -c -o $@ $<
@echo " done”

clean:
@$(RM) -rf *~ *.d *.o *.so *.pcm rflx $(DICT) $(DICT:.cxx=.h) *.dSYM

ifdef PHAST
phast:
@echo “–> Update PHAST $(LIBNAME) library”
@cp *.h $(PHAST)/user/
@cp *.cc $(PHAST)/user/
@cd $(PHAST)/user/; sed -i ‘1i\ #include “Phast.h”’ $(HEADERS)
@echo “–> Copy MunichScaler shell script to phast (waiting for MunichScaler class implementation…)”
@cp MunichScaler $(PHAST)/user/
endif[/code]

I finally understood that there is no need to compile this file derived from TSelector (with a PAR archive).
I can use “.x MySelector.C+” directly…