ROOT Version: 6.22.06 Platform: Windows 10 Compiler: Visual studio 2019
HI,
I started a physics course at university and they required to use root libraries for compiling programs.
Is there a way to use root libraries with Visual Studio 2019?
i tried to install the last release from the site,the 6.22.06, but when i try to include a library in vs it doesnt work,it show an error;
a friend told me it is because root for windows is only for 32bit computers,and mine is 64.
To install root i downloaded the .zip file from the site and then placed it to C:\ ,and then from the vs prompt i run c:\root\bin\thisroot.bat as the installation tutorial says in the release page,but then when i try to include libraries it doesnt work as i said before.
Can anybody tell me what i am doing wrong?you would save my life,thanks
Yes, ROOT is 32 bit only, but works perfectly well on 64 bit computers. But if you want to create your own application, you need to make sure to create a 32 bit application and use the same compiler flags than ROOT itself. I would advise to use CMake to generate the solution file for VS 2019
so i have to write all the root libraries headers an sources on that file, and create the solution file.
but what does the solution file do?sorry i am a real rookie so i have no idea of what to do next
i will try and let you know.
thank you for the help
So you want to use the ROOT libraries but you don’t know how to create an application? Are you sure it’s what you want to do? Or do you want to simply use ROOT? What do you have to do exactly?
in the course i have been doing we started by programming very easy applications first, like writing a program to calculate standard deviation or such,then we started using classes and creating our own statistics classes(which was kinda easy using visual studio),and then we sent the .cpp file(i just did write the source and then run the debug to make sure everythin was running,i never used the prompt).
Then they asked us to write some programmes using root libraries to diplay things like histograms.
but for me it was a problem cause i wasnt using a linux environment and when i try to run that program on vs it doesnt work(i understand vs doesnt have the root libraries on default so using #include doesnt work,so i tried to install root to get the .h files and copy/paste them to the .h folder section of vs but that obviously didnt work), so my problem is how to use root libraries on vs for tings like that .
sorry i am a real newbie so i imagine i might be annoying you,so thank you so much for being so comprehensive
P.S. you can also add the c:\root\lib directory as additional library dir and c:\root\include as additional include dir in Visual Studio, and add the ROOT libraries (e.g. at least libCore.lib and libHist.lib) to be linked with your project
You have to call c:\root\bin\thisroot.bat before running the executable.
If you want to be able to double-click on it from the File Explorer, then you have to create a new environment variable called ROOTSYS, pointing to c:\root and add %ROOTSYS%\bin to your PATH environment variable
Hi,
including the libraries and include files did work,so visual studio doesnt show the root classes as errors anymore,but another problem did show up when i clicked the debug button:
is it because i made something wrong adding new libaries and include dirs on visual studio?
is there a way to solve it?
sorry again to annoy you,and thank you so much in advance.
Since it works on the command prompt, I guess this is a due to a wrong configuration (compiler flag). So my question is: why don’t you use the command prompt (which is simpler)? Otherwise we can spend quite some time here… Anyway, can you try to build in Release mode to see if that change anything?