Use Root in Microsoft Visual C++ Express 2010

Hello everybody,

Im a complete newbe at root. I was looking around the forum to find out how to set up VC++ (WinXP) in a way such that I can use the root framework within VC++. However everything I found was to complicated for me or it didn´t work. So I would be very greatfull if somebody could explain to me how to do so. What Im trying to do is write programs in VC++ and using the root classes. Id be very thankful for your help.

Best Regards,

Laura

[quote=“Laura”]Hello everybody,

Im a complete newbe at root. I was looking around the forum to find out how to set up VC++ (WinXP) in a way such that I can use the root framework within VC++.
Laura[/quote]

Thanks to

rootbuilder.codeplex.com/

  • this is trivial procedure today and you do not need cygwin. The only problem - I was using Express 2008, not 2010 and I was not able to compile with 2010 because of MS std library (in fact it was not really interesting for me and I simply stick to VS Express 2008)

Ok thank you very much,
so I now installed VC++ Express 2008. I used root builder to create my project. I then manually opened the root_build_project file with VC++. I then click build and get the following error message:

1>------ Erstellen gestartet: Projekt: ROOT Build, Konfiguration: IFMPRoot Win32 ------
1>Die Makefile-Projektaktionen werden ausgeführt.
1>vside/setup_config_IFMPRoot.sh: ./configure: No such file or directory
1>make: *** No targets specified and no makefile found. Stop.
1>Projekt : error PRJ0002 : Fehler “2” wurde von “C:\WINDOWS\system32\cmd.exe” zurückgegeben.
1>Das Buildprotokoll wurde unter “file://c:\root\bin\BuildLog.htm” gespeichert.
1>ROOT Build - 1 Fehler, 0 Warnung(en)
========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========

My plan is to create a project that lets me run a code snippet like the following out of VC++:

Double_t w = 600;
Double_t h = 600;
TCanvas * c1 = new TCanvas(“c”, “c”, w, h);
c->SetWindowSize(w + (w - c->GetWw()), h + (h - c->GetWh()));

Thanks for your help in advance,

Laura

Hello, Laura.

This is really strange. Just to check, I did the following:

  1. downloaded svn trunk version of root (you can have another version of ROOT, that’s ok).
  2. started ROOT Build Builder. This is a simple dialog, I just specified the path to root source tree and
    selected VS 2008 and pressed “Generate project”.
  3. Opened the generated project from VS 2008 and started build (Release).
  4. It’s still building, but I do not have any errors you have.

I now tried it with VC 08

My error message is:

1>------ Build started: Project: ROOT Build, Configuration: Release Win32 ------
1>Performing Makefile project actions
1>vside/setup_config_Release.sh: ./configure: No such file or directory
1>make: *** No targets specified and no makefile found. Stop.
1>Project : error PRJ0002 : Error result 2 returned from ‘C:\WINDOWS\system32\cmd.exe’.
1>Build log was saved at "file://c:\root\bin\BuildLog.htm"
1>ROOT Build - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Does somebody know how I can fix this?
How should I create a makefile?
And what exactly means: 1>make: *** No targets specified and no makefile found. Stop.

Thank you for your help

Laura

[quote=“Laura”]
1>------ Build started: Project: ROOT Build, Configuration: Release Win32 ------
1>Performing Makefile project actions
1>vside/setup_config_Release.sh: ./configure: No such file or directory
1>make: *** No targets specified and no makefile found. Stop.
1>Project : error PRJ0002 : Error result 2 returned from ‘C:\WINDOWS\system32\cmd.exe’.
1>Build log was saved at “file://c:\root\bin\BuildLog.htm”
1>ROOT Build - 1 error(s), 0 warning(s)

Laura[/quote]

Oh, cmon, this is really trivial.
You start ROOT Build Builder dialog. I’ve attached the screenshot. Let’s say, you have root source tree on C:\root and you have visual studio 2008 (yes, by the way, you need root’s source code, do you have it?).
In this dialog, you have to: specify the correct path to existing root source code, select version of MSVC, press button Generate Project. I’ve marked this in red. After this, you have to go to your $ROOTSYS (C:/root), open the generate VC project, and start the compilation. That’s all.

From your error message I can see, that you generated the project somewhere else, not in a root source dir.
Or, may be you have problem with source code? How and what did you download? I have an SVN trunk version of ROOT. What do you have?


Hi,

just as a side note: ROOT (e.g. 5.28) compiles just fine with MSVC 2010. Laura, you are welcome to have a different opinion on what Timur finds “really trivial” :slight_smile: Please let us know if you continue to have problems building ROOT.

Cheers, Axel.

Hi,

I am noob on Root and i try to use the root builder for visual c++ 2010. So, i have an error mesage when i clic on generate project. This message is in attache file.
can you help me please

Jeremie.
root_builder_error.txt (5.45 KB)

Hi Jeremie,
Interesting. This particlar crash indicates that root builder was unable to track down the location of the Visual Studio 2010 install. If you don’t mind, I have a set of questions for you: :slight_smile:

  1. What is the operating system you are running?
  2. What version of Visual Studio 2010 do you have installed (express, professional, etc.)
  3. Can you tell me if the registry key “local machine\SOFTWARE\Microsoft\VisualStudio\10.0” exists?
  4. Can you tell me if the registry key “classes\VisualStudio.accessor.10.0\shell\Open\Command” exists?

What is happening is root builder is trying to figure out where 2010 is installed, and then use that to make sure that the proper environment variables are defined when the make command is issued. So far, the most robust way of doing that has been to look at these registry entries. The bomb should be better - I should throw an informative error rather than just that null pointer error you are seeing. I’ve added that to the list of things to fix for the next version. Thanks!

So,

Firstly, thank for your quick answer.
Secondly, I work on W7 SP1 32 bits and i have Visual C++ 2010 express edition (up to date by windows update automatically). I find the first registry key but not the second. but i have found this key :
classes\VCExpress.AddIn.10.0\shell\Open\Command

Best, Jeremie

Hi,
Fantastic. Ok, so that is the bug - it isn’t setup to detect express correctly. Let me look at the code a bit more and figure out how much work I need to do to get around that problem…

Cheers,
Gordon.