Hi,
I’m using TASImage::GetZoomPosition in a GUI. It works when I run/compile the code with ROOT, but when compiling a linux standalone executable with g++, I get the following error:
[quote]statBar.cxx:(.text+0x1df): undefined reference to `TASImage::GetZoomPosition(unsigned int&, unsigned int&, unsigned int&, unsigned int&) const’
collect2: ld returned 1 exit status[/quote]
The code example statBar.cxx is attached, it will require statBar.h and when compiling with g++ also statBarLinkDef.h (see both files attached).
-
ROOT
Run “root statBar.cxx++” - clicking the GUI button will print the zoom position to the screen. Try to zoom and click the button again - all works fine. -
G++
a) create dictionary in bash: rootcint -f statBarDict.cxx -c statBar.h statBarLinkDef.h
b) compile: g++root-config --cflags --glibs-o statBar statBar.cxx statBarDict.cxx
-> this will produce the error
c) Comment out line “img->GetZoomPosition(xx, yy, ww, hh);” and compile again with step b)
then run in bash: ./statBar
-> compilation will work this time - but after zooming the image, of course, you don’t get the correct zoom position anymore
The code snippet of interest is:[code]
void MyMainFrame::PrintZoomPos()
{
UInt_t xx = 50;
UInt_t yy = 51;
UInt_t ww = 52;
UInt_t hh = 53;
TASImage img = static_cast<TASImage>( fEcan->GetCanvas()->FindObject( fImg->GetName() ) );
std::cout << img->GetName() << std::endl;
img->GetZoomPosition(xx, yy, ww, hh);
std::cout << xx << “\t” << yy << “\t” << ww << “\t” << hh << std::endl;
}
[/code]
To ask a clear question: How can I get the correct zoom position in the standalone g++ version?
Thanks
statBar.cxx (4.34 KB)
statBar.h (817 Bytes)
statBarLinkDef.h (36 Bytes)