Dear ROOTers,
In order to implement a stand alone code which is able to handle the mouse and keyboard events, I thought I could try to compile and run the gui example statusBar.C
.
Prior to any changes, I tested successfully the code on the root prompt as :
.x statusBar.C
I tried to modified the code according to the recommendations in the following post. But I still did not manage to compile the code successfully with a command-line solution and a CMakeList.txt solution:
$ g++ -std=c++14 statusBar.cxx `root-config --glibs --cflags` -o statusBar
/tmp/cccT5439.o: In function `MyMainFrame::IsA() const':
statusBar.cxx:(.text._ZNK11MyMainFrame3IsAEv[_ZNK11MyMainFrame3IsAEv]+0xd): undefined reference to `MyMainFrame::Class()'
/tmp/cccT5439.o: In function `MyMainFrame::ShowMembers(TMemberInspector&) const':
statusBar.cxx:(.text._ZNK11MyMainFrame11ShowMembersER16TMemberInspector[_ZNK11MyMainFrame11ShowMembersER16TMemberInspector]+0x11): undefined reference to `MyMainFrame::Class()'
/tmp/cccT5439.o:(.rodata._ZTV11MyMainFrame[_ZTV11MyMainFrame]+0x1d8): undefined reference to `MyMainFrame::Streamer(TBuffer&)'
/tmp/cccT5439.o:(.rodata._ZTV11MyMainFrame[_ZTV11MyMainFrame]+0x600): undefined reference to `non-virtual thunk to MyMainFrame::Streamer(TBuffer&)'
collect2: error: ld returned 1 exit status
and with CMakeLists.txt (3.8 KB) giving the error:
-- Project: statusBar -- Compiling with -std=c++14 -- Installation of ROOT found: ----> root-6.10.08 -- ROOT_VERSION >= 6.0 YES -- Configuring done -- Generating done -- Build files have been written to: /home/sotty/Experiments/IS608/root/macros/StatusBar/build Scanning dependencies of target statusBar [ 50%] Building CXX object CMakeFiles/statusBar.dir/statusBar.cxx.o [100%] Linking CXX executable statusBar CMakeFiles/statusBar.dir/statusBar.cxx.o: In function `MyMainFrame::MyMainFrame(TGWindow const*, unsigned int, unsigned int)': statusBar.cxx:(.text+0x627): undefined reference to `TGMainFrame::TGMainFrame(TGWindow const*, unsigned int, unsigned int, unsigned int)' statusBar.cxx:(.text+0x65a): undefined reference to `TGFrame::GetDefaultFrameBackground()' statusBar.cxx:(.text+0x698): undefined reference to `TRootEmbeddedCanvas::TRootEmbeddedCanvas(char const*, TGWindow const*, unsigned int, unsigned int, unsigned int, unsigned long)' statusBar.cxx:(.text+0x710): undefined reference to `TRootEmbeddedCanvas::AdoptCanvas(TCanvas*)' statusBar.cxx:(.text+0x78f): undefined reference to `TGCompositeFrame::AddFrame(TGFrame*, TGLayoutHints*)' statusBar.cxx:(.text+0x7b0): undefined reference to `TGFrame::GetDefaultFrameBackground()' statusBar.cxx:(.text+0x7e5): undefined reference to `TGStatusBar::TGStatusBar(TGWindow const*, unsigned int, unsigned int, unsigned int, unsigned long)' statusBar.cxx:(.text+0x897): undefined reference to `TGCompositeFrame::AddFrame(TGFrame*, TGLayoutHints*)' statusBar.cxx:(.text+0x89c): undefined reference to `TGFrame::GetDefaultFrameBackground()' statusBar.cxx:(.text+0x8da): undefined reference to `TGButton::GetDefaultGC()' statusBar.cxx:(.text+0x8e2): undefined reference to `TGGC::operator()() const' statusBar.cxx:(.text+0x8ea): undefined reference to `TGTextButton::GetDefaultFontStruct()' statusBar.cxx:(.text+0x921): undefined reference to `TGTextButton::TGTextButton(TGWindow const*, char const*, int, unsigned long, unsigned long, unsigned int)' ...
Here you can find the CMakeList.txt and statusBar.cxx (modified):
statusBar.cxx (6.0 KB)
CMakeLists.txt (3.8 KB)
Any comments or ideas are very welcome.
Cheers,
Christophe