Building ROOT dictionaries in VisualC++.NET and Geant4

Hello all

I want to use ROOT for histograms and analysis work in Geant4. I successfully installed ROOT and it runs by itself under cygwin. Now I want to link the ROOT libraries with my existing Geant4 project running under Windows XP.

I followed the instructions in the guide “ROOT and Visual C++.NET 2003 (7.1)”
( and adapted the settings of the “custom build step” to match my project. I also created a new file “LinkDef.h” and left it empty, since I do not know what needs to be in there.

When building the project, the “custom build step” fails with the message:
------ Build started: Project: Sterilisation_01, Configuration: Debug Win32 ------
Building ROOT dictionary
Error: cannot open file “globals.hh” FILE:Steril01Analysis.h LINE:39

“globals.hh” is my first include file in “Steril01Analysis.h”, which I listed under “Additional Dependencies” in the “custom build step”.

So it looks like the linker does not know the PATH of the Geant4 libraries. Is that something I have to put into the file “Link.Def.h”? What exactly is this file doing and what need to be in there?

Your help is appreciated very much. Thanks in advance

Add the G4 include in your INCLUDE path.


Hello Rene
The “custon build step” does not allow any additional INCLUDE definitions. And my Project Properties do have the G4 includes included.

If I just want to use the ROOT libraries and classes to fill, save and draw histograms do I even need the dictionary files and the LinkDef.h file?


Hi Matthias,
you can try two things:

  • in MSVC, go to Tools->Options->Projects->VC++ Directories, under “Show directories for:” select the “Include files” entry, and add (using the folder symbol) a new entry for your geant include dir.

  • If that doesn’t work, edit the custom build step. Instead of “$(ROOTSYS)\bin\rootcint -f TMusterdict.cpp -c TMuster.h LinkDef.h”, set “$(ROOTSYS)\bin\rootcint -f TMusterdict.cpp -c -IC:\Geant\include TMuster.h LinkDef.h” (note that you’ll have to change the geant include path to whatever is applicable for your installation!)