Empty list of colors

Hi all,

I’ve observed that the list of colors is empty if one compiles a program with root libraries with the standard c++ compiler. That is a piece of code I used to see this:

#include <root/TROOT.h>

int main( void )
std::cout << gROOT->GetListOfColors()->At( 100 ) << std::endl;
return 0;

The output of the program is a zero, but I would expect to receive a not null pointer that I can cast to a pointer to TColor.

The command line I’ve used to compile the code is the following:

g++ -o test test.cc -L $ROOTSYS/lib -lCore -lCint -lHist -lMatrix -lGraf -lGraf3d -lGpad -lm -ldl

I’ve read it’s the way to read a color from the list of colors, but probably I have to tell the program to fill this list first. What is the command I’m missing?

Thanks in advance.

  • Jordi.

You must create a TApplication object (or at least a TCanvas).