Hello,
I have difficulties compiling and linking a simple ROOT program.
I wrote a main.cpp and MainFrame.h + MainFrame.cpp
Here’s the Makefile used :
[code]OBJS = MainFrame.o main.o
LIBS = root-config --glibs
-lHtml -lSpectrum
CXXFLAGS = -O2 -g -Wall root-config --cflags
-fmessage-length=0
TARGET = app
NET_LIB_F := -DNET_LIB
ROOTCFLAGS := $(shell root-config --cflags) -I$(ROOTSYS)/xmlparser/inc -I$(ROOTSYS)/io/xmlparser/inc
$(TARGET): $(OBJS)
$(CXX) -o $(TARGET) $(OBJS) $(LIBS)
GDict : main.h
@echo “Generating dictionary $@…”
@rootcint -v -f $@ -c -p -D__const=const -D__timezone_ptr_t=void $(NET_LIB_F) $(ROOTCFLAGS) ./main.h
@echo “$@ done”
all: GDict $(TARGET)
clean:
rm -f $(OBJS) $(TARGET)
[/code]
But I get undefined references errors.
MainFrame.o: In function `MainFrame::IsA() const':
/home/eoutin/workspace/M1/MainFrame.h:26: undefined reference to `MainFrame::Class()'
MainFrame.o:(.rodata._ZTV9MainFrame[vtable for MainFrame]+0xe8): undefined reference to `MainFrame::ShowMembers(TMemberInspector&)'
MainFrame.o:(.rodata._ZTV9MainFrame[vtable for MainFrame]+0xec): undefined reference to `MainFrame::Streamer(TBuffer&)'
I know that I need to generate dictionaries, but no idea how does it work within the Makefile.
Thanks in advance for help,
eoutin