Dear,
Recently, I am trying to do a GUI executable file using root. As a beginner, I am not familiar to makefile and this is my first time to compile a executable using makefile.
when I try to make , I got errors as following:
[quote]MyMainFrame.o: In function MyMainFrame::IsA() const': MyMainFrame.C:(.text._ZNK11MyMainFrame3IsAEv[_ZNK11MyMainFrame3IsAEv]+0x10): undefined reference to
MyMainFrame::Class()’
MyMainFrame.o:(.data.rel.ro._ZTV11MyMainFrame[_ZTV11MyMainFrame]+0xe8): undefined reference to MyMainFrame::ShowMembers(TMemberInspector&)' MyMainFrame.o:(.data.rel.ro._ZTV11MyMainFrame[_ZTV11MyMainFrame]+0xec): undefined reference to
MyMainFrame::Streamer(TBuffer&)’
MyMainFrame.o:(.data.rel.ro._ZTV11MyMainFrame[_ZTV11MyMainFrame]+0x2fc): undefined reference to non-virtual thunk to MyMainFrame::ShowMembers(TMemberInspector&)' MyMainFrame.o:(.data.rel.ro._ZTV11MyMainFrame[_ZTV11MyMainFrame]+0x300): undefined reference to
non-virtual thunk to MyMainFrame::Streamer(TBuffer&)’
collect2: error: ld returned 1 exit status
makefile:21: recipe for target ‘runGUI’ failed
make: *** [runGUI] Error 1
liyj@liyj:~/Desktop/build4$
[/quote]
attached : Makefile below, and my code in attachments.
Someone please help.
thanks a lot!
# ROOT
ROOTCFLAGS = $(shell root-config --cflags)
ROOTLIBS = $(shell root-config --libs)
ROOTGLIBS = $(shell root-config --glibs)
# Linux
CXX = g++
CXXFLAGS = -O -Wall -fPIC -I$(ROOTSYS)/include
CXXFLAGS += $(ROOTCFLAGS)
LIBS = $(ROOTLIBS) -lgcc -lm -ldl -rdynamic
GLIBS = $(ROOTLIBS) $(ROOTGLIBS)
#------------------------------------------------------------------------------
OBJS = MyMainFrame.o main.o
runGUI: ${OBJS}
${CXX} -o runGUI ${CXXFLAGS} ${OBJS} $(LIBS) $(GLIBS)
MyMainFrame.o: MyMainFrame.C MyMainFrame.h
${CXX} ${CXXFLAGS} -c MyMainFrame.C
main.o: main.C
${CXX} ${CXXFLAGS} -c main.C
clean:
rm -f runGUI ${OBJS}
@echo "all cleaned up!"
MyMainFrame.h (654 Bytes)
MyMainFrame.C (2.37 KB)
main.C (358 Bytes)