Using ROOT in Visual Studio 2012 c++

Hi everybody,

I am developing the source code for a pretty complex project. This is a c++ code that should manage the data control and acquisition of a measurement device. I would like to use the ROOT libraries such as Histograms, fits and so on using Visual Studio Express 2012 under windows 7.
I have been looking and googling around for quite a while and i already set up something:

C:\root\bin
C:\root\lib

are added as additional library directories for the linker (where C:\root\ is the path to my working installation of ROOT) and

as additional dependencies in the linker input. Also in the c/c++ general part

C:\root\include is listed as additional include directory.
The simple code (just declaring an histogram, fill it and try to print the RMS and mean) that i use for test do compile, but when i try to run it, a pop-up appear saying that the system does not have libCore.dll . Googling a bit and i found that i should add the SYSROOT variable somewhere in windows.
At this point my questions are: how to add it? why do i have to add it? Is it possible to define this variable directly in the code?

Thank you in advance.

Hi,

You have several options: execute the root\bin\thisroot.bat script which will set up the environment variables for you in a command prompt, or create a ROOTSYS environment variable (in computer -> properties -> advanced system settings -> environment variables) pointing to the location where you installed root, and then add %ROOTSYS%\bin to your %PATH% environment variable

EDIT: BTW, this is probably going to fail, since we don’t have binaries for VS 2012…

Cheers, Bertrand.

it works.

std::cout<<"mean : "<<h1->GetMean()<<" std : "<<h1->GetRMS()<<std::endl;
shows the right values :slight_smile:

Thanks!

Good news! And you’re welcome! :slight_smile:
Cheers, Bertrand.

Hi, guys!
I know this is SOLVED but I have to ask my stupid questions.

So, BaNco, can you describe the steps in more detail. My problem is that I don’t know what folders exactly you changed (not to mention that I don’t know if my method of changing the folders is OK…using the Property Manager for every project). So, you said:
[i]C:\root\bin
C:\root\lib
are added as additional library directories for the linker
libCore.lib;libGPad.lib;libGui.lib;libGraf.lib;libTree.lib;libHist.lib;libCint.lib;libRint.lib;
as additional dependencies in the linker input.
C:\root\include
is listed as additional include directory.
[\i]
So what does all that mean? Where exactly did you add those?
And then, bellenot told you to add some more paths and it worked. So can you point me to the exact directories and how to change them? I pressed the “?” in the VSC++ in the Directories, but there it says something about normal environment folders (INCLUDE, PATH, etc. - INCLUDE doesn’t even exist in the environments paths). I already added the root folder in the PATH environment but I need more.

Sorry for bothering you with this,
Adrian