How can i compile root source on windows with Visual C++

hi all,

i am trying to compile root from source with Visual Studio 2010 Express (C++)
i can get compiled codes, but files are in subdirectories like “Debug” and "Release"
with this, i cant get any running compilation of ROOT.

i had tried two ways.

1-
i used cmake gui version for windows - (cmake.org/)
then tried to open solution file with VC++ Express.
it gaves me many errors. it says "solution folders are not supported in this version"
with this, i continue and try "build solution"
it works but in the end, things goes to subdirectories such as “Debug”

2-
this time i opened command window and used "cmake c:\rootsvn"
then used "c:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe ROOT.sln"
it completes with 10 warnings and 2 errors, with almost everything compiled.
results is the same as above, say, binary files are placed under “bin/Debug” subdirectory.

i hope someone can help with the problem.

note1: there is not enough information in documentations or on forums to compile root with VC++.
it is still something good to have result this far.
note2: i have almost no problems using root with VC++ to write my programs, using the precompiled setup, except some differences i get between linux and windows. i even made a portable version of VC++.

Hi,

Visual Studio places the libraries and executables in subdirectories named as the ‘configuration’. There is nothing that can be done about this. What you are missing in your build attempts is the installation step (‘install’ target), which moves the libraries and other artifacts to their final destination. Unfortunately this step is mandatory when building with Visual Studio. The installation destination is controlled by the CMake variable CMAKE_INSTALL_PREFIX, which by default is set to be the source tree (I think).

cmake -DCMAKE_INSTALL_PREFIX=<…> C:\rootsvn

The following command should do the work:

<…>\MSBuild.exe ROOT.sln /build RelWithDebInfo /project install

You mention that it completes with 10 warnings and 2 errors. Can you please report what these errors are?

thank you for showing me missing part.
i have found that without the prefix cmake takes the current directory to install
but one must not forget to make “install” step :smiley:
this time i tried 5.33.02 version. if i make a succesfull compile, then it should work for other version.

method-1
building with visual studio solution file has problems as i said before. please see attachment.

instead of “/build RelWithDebInfo”, “/p:Configuration=RelWithDebInfo” is required
and “/project install” didnt worked, nor could i find something to do the install

cmake -DCMAKE_INSTALL_PREFIX=z:\root -G"Visual Studio 10" z:\root-svn\tags\v5-33-02 c:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe ROOT.sln /p:Configuration=RelWithDebInfo
also used this code instead of second line but nothing changed (still 10 warnings 2 errors)
cmake --build . --target install --config RelWithDebInfo
i also find out if i use following code, it will install with the correct directory structure

cmake -DCMAKE_INSTALL_PREFIX=z:\root -P cmake_install.cmake

method-2
without “-G” parameter, cmake gave me make files instead of VS solution
the following seems to give correct directory structure
(i just cant verify because i dont know exactly how it must be)

cmake -DCMAKE_INSTALL_PREFIX=z:\root z:\root-svn\tags\v5-33-02 nmake nmake install
mymy.txt (1.05 MB)