Undefined reference to `TDatabasePDG::Instance()

(ROOT 6.13/03 Built for linuxx8664gcc From heads/master@v6-13-02-720-g49a64e5)

Hi, Everyone, I have the problem:

make main112
g++ main112.cc main112.so -o main112 -w -I/opt/root6/include -I../include -O2  -pedantic -W -Wall -Wshadow -fPIC -L../lib -Wl,-rpath,../lib -lpythia8 -ldl \
 `root-config --cflags` -Wl,-rpath,./\
 -Wl,-rpath,/opt/root6/lib `/opt/root6/bin/root-config --glibs`
/tmp/ccnQiqUQ.o: In function `HxSimParticle::GetPDG()':
main112.cc:(.text+0x91a): undefined reference to `TDatabasePDG::Instance()'
main112.cc:(.text+0x925): undefined reference to `TDatabasePDG::GetParticle(int) const'
collect2: error: ld returned 1 exit status
Makefile:202: recipe for target 'main112' failed
make: *** [main112] Error 1

Makefile:

FLAGS = -w -I/opt/root6/include -I../include -O2  -pedantic -W -Wall -Wshadow -fPIC -L../lib -Wl,-rpath,../lib -lpythia8 -ldl  `root-config --cflags` -Wl,-rpath,./ -Wl,-rpath,/opt/root6/lib `/opt/root6/bin/root-config --glibs`

ROOTLIBS += -lEG -lGui -lASImage -lASImageGui

main112: $$@.cc $(PREFIX_LIB)/libpythia8.a main112.so
ifeq ($(ROOT_USE),true)
	$(CXX) $< main112.so -o $@ -w -I$(ROOT_INCLUDE) $(CXX_COMMON)\
	 `$(ROOTBIN)root-config --cflags` -Wl,-rpath,./\
	 -Wl,-rpath,$(ROOT_LIB) `$(ROOT_BIN)root-config --glibs`
else
	@echo "Error: $@ requires ROOT"
endif
main112.so: main112Dct.cc $(PREFIX_LIB)/libpythia8.a
	$(CXX) $< -o $@ -w -I$(ROOT_INCLUDE) $(CXX_SHARED) $(CXX_COMMON)\
	 `$(ROOTBIN)root-config --cflags` $@ $(ROOTLIBS)
main112Dct.cc: main112.h HxSimParticle.h HxSimEvent.h main112LinkDef.h
	export LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(ROOT_LIB);\
	 $(ROOT_BIN)rootcint -f $@ -c -I$(PREFIX_INCLUDE) $^

Someone know what am I doing wrong?

Cheers, Andre

`/opt/root6/bin/root-config --evelibs`
1 Like

Thanks, it worked!

Cheers, Andre

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