Root & MS Visualcpp 2012 :: TVirtualStreamerInfo error

Hi ROOTers,

I am trying to set ROOT in a windows environment, using Visual CPP 2012
I used the pre-compiled tarball for VC++ 10 (root 5.34/10)
and wrote a little test-code to see if it’s working
I can compile the code, I can run the code but I get several errors showing that ROOT is not working correctly :
Here is my test-case

#include <iostream> 
#if (!defined(__CINT__) || defined (__MAKECING__)) //Is it really necessary some tutorial say yes
#pragma once
#include <Windows4Root.h>
#include <TROOT.h>
#include <TMath.h>
#include <TApplication.h>
#include <TCanvas.h>
#include <TH1F.h>
#include <TFile.h>

using namespace std;

int main() { 

  cout << "Hello World" << endl;
  cout << TMath::Pi() << endl; //This is displaying 3.14159...
  TH1F H_test("test","test",10,0,9);
  for (int i=0;i<10;++i) {
  TFile outf("E:\\Images\\out\\test.root","RECREATE"); // test.root exists but is empty 
  TCanvas* can1 = new TCanvas("can","can",640,480);
  //can1->SaveAs(".\\test.png"); //Segfault
  H_test.Write(); //$ROOTSYS/etc/plugins/TVirtualStreamerInfo does not exist 

  return 0;


The Error message is something like
Fatal error inTVirtualStreamerInfo::Factory Cannot find the plugin handler for TVirtualStreamerInfo ! $ROOTSYS/etc/plugins/TVirtualStreamerInfo does not exist…

I set in the environment ROOTSYS=E:\ROOT (Where ROOT has been untared) (The windows way using click on the computer setting) and if I display the environment in a new shell (cmd or powerShell)

If I launch ROOT stand alone from the cmd it seems to be working (i.e. I can open a TBrowser and display content of old files)

Any missing environment variable ?

Any better idea ?


Well, first, You should use Visual C++ 2010 instead of 2012 (they are not compatible)
Then, you have to create a TApplication instance. For example:

[code]int main(int argc, char *argv)
TApplication theApp(“theApp”, &argc, argv);
cout << “Hello World” << endl;
cout << TMath::Pi() << endl; //This is displaying 3.14159…
TH1F H_test(“test”,“test”,10,0,9);
for (int i=0;i<10;++i) {
TFile outf(“E:\Images\out\test.root”,“RECREATE”); // test.root exists but is empty
can1 = new TCanvas(“can”,“can”,640,480);
//can1->SaveAs(".\test.png"); //Segfault
H_test.Write(); //$ROOTSYS/etc/plugins/TVirtualStreamerInfo does not exist

return 0;
You can also look at the example applications in $(ROOTSYS)/test

Cheers, Bertrand

Hi Bertrand,

  • I can check if I can downgrade to Visual studio 2010 (I don’t have admin right on the computer, so it’s not so trivial…)

  • Adding a TApplication (I already tried that before) does not change deeply the situation (Still the same error message, if I don’t save the plot in a root file the console display an error message about canvas size but the canvas is not displayed to the screen), actually from my experience in the Linux world, TApplication is only necessary if I want to display the canvas on the screen (or if I want to use the full ROOT GUI classes) but not if I only want to save canvas as images or plot in a root file (Which is what I do in 90% of the cases), Moreover doing it right add a lot of work (Using signal/slot to manage a user closing a Canvas etc…) Is the philosophy different in the windows world ?

Any other options/ideas, I think I am not so far away from having it working since I can use most of the functions…


You’re right, the TApplication instance is not needed in this case. So maybe it is only due to the Visual Studio version mismatch… (as I can perfectly compile and use your code…)
BTW, how did you install ROOT? is %ROOTSYS% properly set and %ROOTSYS%\bin in the %PATH%?

Cheers, Bertrand.

I installed ROOT from the tar ( untar and copy to user space)

ROOTSYS and ROOTSYS\bin have been set (from the prompt : set shows me that it has been correctly configured)

If I do a cout << getenv(“ROOTSYS”) from the program
it display the working directory.
This can explain why %ROOTSYS\etc is not found
but I have no idea why


OK, could you try to set ROOTSYS and add %ROOTSYS%\bin tot the Path from the Windows environment variables (from the Advanced system settings dialog), and try again ( cout << getenv(“ROOTSYS”) should print the correct value…)

Cheers, Bertrand.