I have a program which can be used in batch as well as in graphical (using ROOT GUI) mode.
Running in batch mode, I always get this warning:
Warning in TUnixSystem::SetDisplay: DISPLAY not set, setting it to xyz2.leeds.ac.uk:0.0
How can I get rid of this warning?
Using root 5.06 on linux with gcc 3.3.3
Did you start your ROOT in “batch” mode
please use the gROOT->SetBatch() before creating the TApplication object.
tried the gROOT->SetBatch( 1 ), but it doesn’t work.
In fact my code works like that:
if( I want GUI )
gROOT->SetBatch( 0 );
… open display …
gROOT->SetBatch( 1 );
As soon as I compile it with the libraries returned by “root-config --glibs” , I get the TUnixSystem::SetDisplay message.
I realize this post is now quite old but I just ran into this issue today. I typically don’t use TApplication but rather compile in the portions of ROOT that I need one by one and try to use them in a self-contained way. Anyway the mentioned error was coming up and I was able to get rid of it without (apparently) loosing any functionality by switching:
“root-config --cflags --glibs”
“root-config --cflags --libs”
in my makefile. I don’t know if this is the proper way to proceed but it seems to be working so far. The only difference is the -lGui flag. In my program I don’t ever need a graphical interface so this seemed to work here. On the other hand I suppose for the case above if you need to switch from graphical output to batch mode without re-compile, this won’t work.
I guess I posted this for the benefit of someone having my (simpler) problem who comes about this post via a search.