MakeFile

:frowning: I have wrotten the example on the book of Root ā€œUsers Guideā€ of pages 356-366,"example2a.cxx and example2a.h"
I have tried to compile it but donā€™t work.
I include in my mail, my Makefile and the errors.
I hope you can help me and say where i wrong.
My Environment variables are Ok.
I use Mandrake 10. I havenā€™t problems to compile examples of directory ā€œtestā€ with them Makefile, I use Root 3.10
Thanks.

MY MAKEFILE


include Makefile.arch

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

EXAMPLE2O       = example2.$(ObjSuf)
EXAMPLE2S       = example2.$(SrcSuf)
EXAMPLE2       = example2$(ExeSuf)

OBJS         = $(EXAMPLE2O)
PROGRAMS     = $(EXAMPLE2)

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

$(EXAMPLE2):      $(EXAMPLE2O)
		$(LD) $(LDFLAGS) $^ $(LIBS) $(OutPutOpt)$@
		@echo "$@ done"

ERRORS WHEN I COMPILE:

[gpcalma@EMANUELE test]$ make -f Makefile2
g++ -O -Wall -fPIC -D_REENTRANT -I/home/gpcalma/root/v3-10-02/include -c example
2.cxx
g++ -O example2.o -L/home/gpcalma/root/v3-10-02/lib -lCore -lCint -lHist -lGraf
-lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lpthread -lm -ldl
 -rdynamic  -o example2
example2.o(.text+0x71): In function `MyMainFrame::MyMainFrame[not-in-charge](TGW
indow const*, unsigned, unsigned)':
: undefined reference to `TGMainFrame::TGMainFrame[in-charge](TGWindow const*, u
nsigned, unsigned, unsigned)'
example2.o(.text+0x8f): In function `MyMainFrame::MyMainFrame[not-in-charge](TGW
indow const*, unsigned, unsigned)':
: undefined reference to `TGFrame::GetDefaultFrameBackground()'
example2.o(.text+0xb2): In function `MyMainFrame::MyMainFrame[not-in-charge](TGW
indow const*, unsigned, unsigned)':
: undefined reference to `TRootEmbeddedCanvas::TRootEmbeddedCanvas[in-charge](ch
ar const*, TGWindow const*, unsigned, unsigned, unsigned, unsigned long)'
example2.o(.text+0xe0): In function `MyMainFrame::MyMainFrame[not-in-charge](TGW
indow const*, unsigned, unsigned)':
: undefined reference to `vtable for TGLayoutHints'
example2.o(.text+0x14d): In function `MyMainFrame::MyMainFrame[not-in-charge](TG
Window const*, unsigned, unsigned)':
: undefined reference to `TGFrame::GetDefaultFrameBackground()'
example2.o(.text+0x161): In function `MyMainFrame::MyMainFrame[not-in-charge](TG
Window const*, unsigned, unsigned)':
: undefined reference to `TGCompositeFrame::TGCompositeFrame[not-in-charge](TGWi
ndow const*, unsigned, unsigned, unsigned, unsigned long)'
example2.o(.text+0x177): In function `MyMainFrame::MyMainFrame[not-in-charge](TG
Window const*, unsigned, unsigned)':
: undefined reference to `vtable for TGHorizontalFrame'
example2.o(.text+0x185): In function `MyMainFrame::MyMainFrame[not-in-charge](TG
Window const*, unsigned, unsigned)':
: undefined reference to `vtable for TGHorizontalFrame'
example2.o(.text+0x1a9): In function `MyMainFrame::MyMainFrame[not-in-charge](TG
Window const*, unsigned, unsigned)':
: undefined reference to `TGTextButton::GetDefaultFontStruct()'
example2.o(.text+0x1b5): In function `MyMainFrame::MyMainFrame[not-in-charge](TG
Window const*, unsigned, unsigned)':
: undefined reference to `TGButton::GetDefaultGC()'
example2.o(.text+0x1bd): In function `MyMainFrame::MyMainFrame[not-in-charge](TG
Window const*, unsigned, unsigned)':
: undefined reference to `TGGC::operator()() const'
example2.o(.text+0x1d2): In function `MyMainFrame::MyMainFrame[not-in-charge](TG
Window const*, unsigned, unsigned)':
: undefined reference to `TGTextButton::TGTextButton[in-charge](TGWindow const*,
 char const*, int, unsigned long, unsigned long, unsigned)'
example2.o(.text+0x233): In function `MyMainFrame::MyMainFrame[not-in-charge](TG
Window const*, unsigned, unsigned)':
: undefined reference to `vtable for TGLayoutHints'
example2.o(.text+0x295): In function `MyMainFrame::MyMainFrame[not-in-charge](TG
Window const*, unsigned, unsigned)':
: undefined reference to `TGTextButton::GetDefaultFontStruct()'
example2.o(.text+0x2a1): In function `MyMainFrame::MyMainFrame[not-in-charge](TG
Window const*, unsigned, unsigned)':
: undefined reference to `TGButton::GetDefaultGC()'
example2.o(.text+0x2a9): In function `MyMainFrame::MyMainFrame[not-in-charge](TG
Window const*, unsigned, unsigned)':
: undefined reference to `TGGC::operator()() const'
example2.o(.text+0x2c6): In function `MyMainFrame::MyMainFrame[not-in-charge](TG
Window const*, unsigned, unsigned)':
: undefined reference to `TGTextButton::TGTextButton[in-charge](TGWindow const*,
 char const*, char const*, int, unsigned long, unsigned long, unsigned)'
example2.o(.text+0x300): In function `MyMainFrame::MyMainFrame[not-in-charge](TG
Window const*, unsigned, unsigned)':
: undefined reference to `vtable for TGLayoutHints'
example2.o(.text+0x366): In function `MyMainFrame::MyMainFrame[not-in-charge](TG
Window const*, unsigned, unsigned)':
: undefined reference to `vtable for TGLayoutHints'
example2.o(.text+0x3d6): In function `MyMainFrame::MyMainFrame[not-in-charge](TG
Window const*, unsigned, unsigned)':
: undefined reference to `TGMainFrame::SetWindowName(char const*)'
example2.o(.text+0x503): In function `MyMainFrame::MyMainFrame[in-charge](TGWind
ow const*, unsigned, unsigned)':
: undefined reference to `TGMainFrame::TGMainFrame[in-charge](TGWindow const*, u
nsigned, unsigned, unsigned)'
example2.o(.text+0x521): In function `MyMainFrame::MyMainFrame[in-charge](TGWind
ow const*, unsigned, unsigned)':
: undefined reference to `TGFrame::GetDefaultFrameBackground()'
example2.o(.text+0x544): In function `MyMainFrame::MyMainFrame[in-charge](TGWind
ow const*, unsigned, unsigned)':
: undefined reference to `TRootEmbeddedCanvas::TRootEmbeddedCanvas[in-charge](ch
ar const*, TGWindow const*, unsigned, unsigned, unsigned, unsigned long)'
example2.o(.text+0x572): In function `MyMainFrame::MyMainFrame[in-charge](TGWind
ow const*, unsigned, unsigned)':
: undefined reference to `vtable for TGLayoutHints'
example2.o(.text+0x5df): In function `MyMainFrame::MyMainFrame[in-charge](TGWind
ow const*, unsigned, unsigned)':
: undefined reference to `TGFrame::GetDefaultFrameBackground()'
example2.o(.text+0x5f3): In function `MyMainFrame::MyMainFrame[in-charge](TGWind
ow const*, unsigned, unsigned)':
: undefined reference to `TGCompositeFrame::TGCompositeFrame[not-in-charge](TGWi
ndow const*, unsigned, unsigned, unsigned, unsigned long)'
example2.o(.text+0x609): In function `MyMainFrame::MyMainFrame[in-charge](TGWind
ow const*, unsigned, unsigned)':
: undefined reference to `vtable for TGHorizontalFrame'
example2.o(.text+0x617): In function `MyMainFrame::MyMainFrame[in-charge](TGWind
ow const*, unsigned, unsigned)':
: undefined reference to `vtable for TGHorizontalFrame'
example2.o(.text+0x63b): In function `MyMainFrame::MyMainFrame[in-charge](TGWind
ow const*, unsigned, unsigned)':
: undefined reference to `TGTextButton::GetDefaultFontStruct()'
example2.o(.text+0x647): In function `MyMainFrame::MyMainFrame[in-charge](TGWind
ow const*, unsigned, unsigned)':
: undefined reference to `TGButton::GetDefaultGC()'
example2.o(.text+0x64f): In function `MyMainFrame::MyMainFrame[in-charge](TGWind
ow const*, unsigned, unsigned)':
: undefined reference to `TGGC::operator()() const'
example2.o(.text+0x664): In function `MyMainFrame::MyMainFrame[in-charge](TGWind
ow const*, unsigned, unsigned)':
: undefined reference to `TGTextButton::TGTextButton[in-charge](TGWindow const*,
 char const*, int, unsigned long, unsigned long, unsigned)'
example2.o(.text+0x6c5): In function `MyMainFrame::MyMainFrame[in-charge](TGWind
ow const*, unsigned, unsigned)':
: undefined reference to `vtable for TGLayoutHints'
example2.o(.text+0x727): In function `MyMainFrame::MyMainFrame[in-charge](TGWind
ow const*, unsigned, unsigned)':
: undefined reference to `TGTextButton::GetDefaultFontStruct()'
example2.o(.text+0x733): In function `MyMainFrame::MyMainFrame[in-charge](TGWind                                           ow const*, unsigned, unsigned)':
: undefined reference to `TGButton::GetDefaultGC()'
example2.o(.text+0x73b): In function `MyMainFrame::MyMainFrame[in-charge](TGWind                                           ow const*, unsigned, unsigned)':
: undefined reference to `TGGC::operator()() const'
example2.o(.text+0x758): In function `MyMainFrame::MyMainFrame[in-charge](TGWind                                           ow const*, unsigned, unsigned)':
: undefined reference to `TGTextButton::TGTextButton[in-charge](TGWindow const*,                                            char const*, char const*, int, unsigned long, unsigned long, unsigned)'
example2.o(.text+0x792): In function `MyMainFrame::MyMainFrame[in-charge](TGWind                                           ow const*, unsigned, unsigned)':
: undefined reference to `vtable for TGLayoutHints'
example2.o(.text+0x7f8): In function `MyMainFrame::MyMainFrame[in-charge](TGWind                                           ow const*, unsigned, unsigned)':
: undefined reference to `vtable for TGLayoutHints'
example2.o(.text+0x868): In function `MyMainFrame::MyMainFrame[in-charge](TGWind                                           ow const*, unsigned, unsigned)':
: undefined reference to `TGMainFrame::SetWindowName(char const*)'
example2.o(.text+0xd7d): In function `example()':
: undefined reference to `gClient'
collect2: ld returned 1 exit status
make: *** [example2] Error 1

[/code]

Hi patof,
you need to add ā€œlibGuiā€ to the list of linking libraries.
It can be done with root-config --glibs

Regards. Valeriy