TControlBar in standalone program

From: Guennadi Pospelov <>
Date: Tue, 26 Apr 2005 14:20:42 +0700

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,

Working example, everything together.
:::::::::: :::::::::::
int main()

   TApplication theApp("theapp",0,0);
   TControlBar *bar = new TControlBar("vertical", "KEmcDrawPanel",10,10);    bar->AddButton("myfun","myfun()","nothing special");    bar->Show();
return 0;
:::::::::: myfun.h :::::::::::
extern void myfun();
:::::::::: :::::::::::
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;

:::::::::: link script :::::::::::
rootcint -f -c myfun.h myfunLinkDef.h g++ `root-config --cflags` -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 -c myfun.h myfunLinkDef.h
g++ `root-config --cflags` -c -o main.o
g++ `root-config --cflags` -c -o myfun.o
g++ `root-config --cflags` -c -o myfunDict.o
ar lruv libmyfun.a myfun.o myfunDict.o
g++ -o example2 main.o -L./ -lmyfun `root-config --libs`

All files in the attachment.
ROOT 4/00/08, SLC3

Received on Tue Apr 26 2005 - 09:23:34 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:07 MET