RE: Compiling in Windows using the VC++ IDE

From: Michele Floris <Michele.Floris_at_cern.ch>
Date: Sun, 17 May 2009 16:23:11 +0200

Dear All,

after some effort, I managed to compile a class and macro from within the IDE. I report detailed step-by-step instruction for future reference (hope it may be usefull for somebody else). I put the same instruction, including snapshots, on my web site at http://gruppo3.ca.infn.it/mfloris/?Resources:ROOT. I attach the class and macro used for the test.

Here one has to follow basically the same steps as for a class. Note however that: 1. by default VC will interpret the .C extension as a plain C file (not c++), as a consequence you'll get thousands of errors from the std library. I believe there must be a way to change this default. 2. Also for a macro you need to add to the project a .h file including a declaration of the macro and you'll have to change the rootcint command slightly: rootcint -f HelloDict.cpp -c HelloRoot.h LinkDef.h (I'm not sure I understand why one cannot just use the .cpp file in the rootcint command).

Best Regards,

   Michele.

-----Original Message-----
From: Bertrand Bellenot
Sent: Fri 5/15/2009 11:15
To: Michele Floris
Cc: roottalk_at_root.cern.ch
Subject: RE: [ROOT] Compiling in Windows using the VC++ IDE  

Hi Michele,  

> Do I have to explicitly include a linkdef file also for macros, using something like this:

Depends if you want to compile them and to make a shared library... Please take alook at the Users Guide, ch 15, "Adding a Class with a Shared Library".  

Cheers, Bertrand.


From: Michele Floris
Sent: Friday, May 15, 2009 10:34 AM
To: Bertrand Bellenot
Cc: roottalk_at_root.cern.ch
Subject: RE: [ROOT] Compiling in Windows using the VC++ IDE

Hi,  

Sorry for not replying before: I also got your first message!  

I tried to add the rootcint command in the prebuild events and added the resulting dictionary to the project. I then got some errors at compilation which I was still trying to understand before writing you again. I was planning to do some further tests during the weekend (I have the windows pc @ home).  

Do I have to explicitly include a linkdef file also for macros, using something like this:  

#pragma link C++ function f;

#pragma link C++ function g(int,double);  

Thanks,

Bye,

Michele.  

From: Bertrand Bellenot
Sent: Thursday, May 14, 2009 9:00 PM
To: Michele Floris; roottalk_at_root.cern.ch Subject: Fwd: [ROOT] Compiling in Windows using the VC++ IDE  

Hi,  

As apparently my first reply didn't get through, here it is again...  

Cheers, Bertrand.  

Begin forwarded message:

From: "Bertrand Bellenot" <Bertrand.Bellenot_at_cern.ch>

Date: May 11, 2009 2:33:24 PM GMT+02:00

To: "Michele Floris" <Michele.Floris_at_cern.ch>, <roottalk_at_root.cern.ch>

Subject: RE: [ROOT] Compiling in Windows using the VC++ IDE  

Hi Michele,

There is no problem creating a dll or application within Visual Studio. The dictionary creation step has to be done in the "Pre-Build Event", from the "Build Events" project property. See the attached example screenshot.

Cheers, Bertrand.

-----Original Message-----
From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On Behalf Of Michele Floris
Sent: Monday, May 11, 2009 12:37
To: roottalk_at_root.cern.ch
Subject: [ROOT] Compiling in Windows using the VC++ IDE

Dear All,

I successfully installed root 5.22 compiled with Visual C++ 9.0, using the msi installer. It runs perfectly with the free visual c++ (express edition), and I can compile macros from CINT (e.g. ".L MyMacro.C+").

I would like to ask if it is possible to compile root macros/classes from within the VC++ IDE. I guess the main problem there is the creation of the dictionary... Has anybody tried that?

Thanks,
Best Regards,
Michele.  

Received on Sun May 17 2009 - 16:23:16 CEST

This archive was generated by hypermail 2.2.0 : Tue May 19 2009 - 05:50:03 CEST