Hello,
I am trying to call function myfun() from TControlBar in standalone program
and I have error message
"Function myfun() is not defined in current scope FILE:(tmpfile) LINE:1"
if function and dictionary is inside static library. If everything compilled
together - all works well.
Could you please help me with it?
Many thanks in advance,
Guennadi.
Working example, everything together.
:::::::::: main.cc :::::::::::
int main()
{
TApplication theApp("theapp",0,0);
TControlBar *bar = new TControlBar("vertical", "KEmcDrawPanel",10,10);
bar->AddButton("myfun","myfun()","nothing special");
bar->Show();
theApp.Run();
return 0;
}
:::::::::: myfun.h :::::::::::
extern void myfun();
:::::::::: myfun.cc :::::::::::
void myfun() { printf("button pressed!\n"); }
:::::::::: myfunLinkDef.h :::::::::::
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ function myfun;
#endif
:::::::::: link script :::::::::::
rootcint -f myfunDict.cc -c myfun.h myfunLinkDef.h
g++ `root-config --cflags` main.cc myfun.cc myfunDict.cc -o example1
`root-config --libs`
NOT working example - "myfun() is not defined in current scope"
everything the same except link script
::: link script :::
rootcint -f myfunDict.cc -c myfun.h myfunLinkDef.h g++ `root-config --cflags` -c main.cc -o main.o g++ `root-config --cflags` -c myfun.cc -o myfun.o g++ `root-config --cflags` -c myfunDict.cc -o myfunDict.oar lruv libmyfun.a myfun.o myfunDict.o
All files in the attachment.
ROOT 4/00/08, SLC3
This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:07 MET