Build root dictionaries with visual studio 2005

Hi!
I’m trying to set up the build environment using Francois-Xaviers page for ROOT and Visual C++ 7.1 and his TMuster class.
After setting up everything as instructed, I tried to built the muster solution and receive the error
------ Build started: Project: muster, Configuration: Debug Win32 ------
Building ROOT dictionnary
Error: cannot open file “TMuster.h” (0)
!!!Removing TMusterdict.cpp TMusterdict.h !!!
Error: C:\root\bin\rootcint: error loading headers…
Project : error PRJ0019: A tool returned an error code from "Building ROOT dictionnary"
Build log was saved at "file://c:\Documents and Settings\Aye\My Documents\projects\muster\muster\Debug\BuildLog.htm"
muster - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I tried the custom build command line for the linkdef file directly in a VS prompt window in the muster directory and no problem then.
Should one set maybe the active working directory somehow to the muster directory? But I don’t know how. What I noticed is , that VS creates an extra directory with the same name muster\muster where it stores its managing files, can this be a problem?
I appreciate every hint as usual! :wink:
Cheers,
Michael

Edit: PS: alternatively, maybe somebody has a working solution/project file and could upload it, so that i could see how a working configuration looks like? That would be great! :slight_smile:

Hi Michael,

can you zip your whole build directory (TMuster.h, the project file, etc) and post it? That way we don’t have to guess what the problem is…

Axel.

Thanks for following this up!

Here is the file.
Cheers,
Michael
muster.zip (1.08 MB)

Hi Michael and Axel,
I too am facing the 2005/Dictionary problem. My application is based on an old root wrapper called ActiveRoot (d0.phys.washington.edu/~haas/winroot/index.html) which I was able to move into Visual Studio 2005 with MFC support.
In VS-2005I cannot find some of the references in the muster webpage. Nevertheless I am zipping the project to you and I will be listening hopefully. If I am going in the wrong direction please don’t spend any time on this - just let me know!

Regards,
Steve Alam
GigaRoot1.zip (382 KB)

Hi All,
My apologies - I left out the most interesting file in my archive - here 'tis
gigaroot.cpp (10.6 KB)

Hi Michael,
use $(ROOTSYS)\bin\rootcint -f $(InputDir)TMusterdict.cpp -c $(InputDir)TMuster.h $(InputDir)LinkDef.h for the custom build step. After specifying “$(ROOTSYS)/include” in Project properties / Configuration properties / C/C++ / Additional Include Directories it even compiles.

Hi Steve,
you’re trying to link against a library called RootCint.lib. That doesn’t exist. You probably meant libCint.lib - with that your program works for me. In the Release build the ROOT libraries you are trying to link against all have the wrong name; use the ones from the Debug settings, and also defined $(ROOTSYS)/lib as additional library path, and $(ROOTSYS)/include as additional include path, just as you did for the Debug build.

Note that with current CVS you can use MFC directly, without Andy’s ActiveRoot layer. I’ll suggest to the inventor to post a little HowTo here.

Cheers, Axel.

Hi,

Here is an example of a MFC MDI Application with Root Canvases.
It works with current CVS version. HTH.

Cheers,
Bertrand.
MFCMDIRoot.zip (73.1 KB)

Dear Axel and Bertrnad,
Thanks very much - the proper libraries should go a long way toward building a dictionary! I will try to find some way of building the dictionary only after a clean compile and I’ll keep you posted should I succeed.
Regards,
Steve

Hi Bertrand -
MFC Success! Your example is working with 5.10 and I very much like your child window approach. I am struggling with creating a dictionary for this example (it is more complex than TMuster. So far I have found it neccesary to write a batch file I can use to recreate empty dictionary files for 8.0 when cint deletes them. Any advice is welcome.
Regards,
Steve

Hi Steve,

To generate the dictionary :
Project Properties Dialog :
In BuildEvents, entry Pre-Build Event, put this command :
rootcint -f YourDict.cxx -c YourInclude.h LinkDef.h
And add YourDict.cxx to the list of source files in your project.

Cheers,
Bertrand.

Hi again,
thanks Axel and Bertrand.
Just for the archive in case one has saved the project files of VStudio in a path that contains space, one should write the custom buildstep like this:
$(ROOTSYS)\bin\rootcint -f TMusterdict.cpp -c “$(InputDir)TMuster.h” “$(InputDir)LinkDef.h”
(Note the quotation marks)
(I heard about the space-in-path-problem before, and I was a good boy and installed my root in a path without spaces, but didn’t realise that because of the use of rootcint, one even should follow that rule for the VC projects).

Now one question remains for me about this topic:
Bertrand recommended to put the dictionary in the prebuilt-step, whereas Francois’ page puts it into the property page of the Linkdef.h. But Francois actually complains that the dictionary is built BEFORE compiling the project. So would a solution here not be, to put it in a post-built event? And what is actually the difference to put it as a property of Linkdef.h and a general pre/post build event?

And concerning a full standalone Muster-Application, I have gone a bit further and learned how to create a Windows-Installer. I have learned how to add Merge Modules to the installer to distribute required VC libs. But now I’m facing a problem, where I need help of ROOTers again:
Visual Studio found automagically the dependencies for the Muster-Application to create the Installer. Listed and copied into the application folder are so far
libCint.dll, libCore.dll, libHist.dll and libRint.dll.
On my computer this installation works fine, but on the target computer (without ROOT) after launching the executable, an error appears, saying libMatrix.dll is needed. Now the funny part is: on my PC, this dll is actually empty (a 0 kb file). So including the copying of this file into the installer folder didn’t help, the error message (after deinstalling/reinstalling all the time of course) did say, that libMatrix.dll is not a legal page file, or so.
So what magic is working here? Why does it run on my PC, where this dll is empty as well? And is it really needed by the Muster-applciation? (Note, that i added the creation of a TMuster object and a draw command to actually see something happening. Works fine here, but not on the target).
If you can help me here to make this work, I promise I’ll make a walkthrough page for people who want to do the same, cause although you guys usually don’t recommend to create stand-alone apps, I think many people would like to be able to create a totally independent app once in a while.
Many thanks already, I’m almost there! :slight_smile:
Michael

Hi Michael,

The dictionary must be generated before the build event, since it is linked to the application at build time :wink: . So I put it in the pre-build events.

About the empty (0 kb size) dlls, the real dlls are in $(ROOTSYS)/bin and not in $(ROOTSYS)/lib (these are only used for the compilation)

Cheers,
Bertrand.

To see which ROOT DLLs are loaded and required change your %ROOTSYS%/etc/system.rootrc file to get

Root.ShowPath: false and re-run your application.

ah, thanks again for the tips.
Interestingly, it seems like I don’t need libMatrix.dll, so why is it asked for on the target PC then?

Which: libGpad.dll = C:\root\bin\libGpad.dll
Which: libCore.dll = C:\root\bin\libCore.dll
Which: libCint.dll = C:\root\bin\libCint.dll
Which: libHist.dll = C:\root\bin\libHist.dll
Which: libRint.dll = C:\root\bin\libRint.dll
Which: KERNEL32.dll = C:\WINDOWS\system32\KERNEL32.dll
Which: libWin32gdk.dll = C:\root\bin\libWin32gdk.dll
Which: libGui.dll = C:\root\bin\libGui.dll
Which: arialbd.ttf = C:\root\fonts\arialbd.ttf
Which: arialbd.ttf = C:\root\fonts\arialbd.ttf


  •                                     *
    
  •    W E L C O M E  to  R O O T       *
    
  •                                     *
    
  • Version 5.08/00 13 December 2005 *
  •                                     *
    
  • You are welcome to visit our Web site *
  •      [root.cern.ch](http://root.cern.ch)            *
    
  •                                     *
    

Compiled on 15 December 2005 for win32.

CINT/ROOT C/C++ Interpreter version 5.16.5, November 30 2005
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
Which: libvectorDict.dll = C:\root\bin\libvectorDict.dll
Which: libMinuit.dll = C:\root\bin\libMinuit.dll
Which: libPostscript.dll = C:\root\bin\libPostscript.dll
Which: libHtml.dll = C:\root\bin\libHtml.dll
Which: libASImage.dll = C:\root\bin\libASImage.dll
Which: arrow_left.xpm = C:\root\icons\arrow_left.xpm
Which: arrow_right.xpm = C:\root\icons\arrow_right.xpm
Which: arrow_up.xpm = C:\root\icons\arrow_up.xpm
Which: arrow_down.xpm = C:\root\icons\arrow_down.xpm
Which: macro_s.xpm = C:\root\icons\macro_s.xpm
TCanvas::MakeDefCanvas: created default TCanvas with name c1
root [0] Which: libHistPainter.dll = C:\root\bin\libHistPainter.dll

Anyway, I will try to install these files as well (although the sense of recommendation becomes clearer now… :-S ) and keep this page updated about my success.
Cheers,
Michael

Edit: Hmm, why actually are all this libraries loaded for a simple application like Muster? (libMinuit is surely not needed?) Is this not some kind of default library load at start? Can this be suppressed, or does one really have to install libMinuit and libHtml and others for this very simple application?

Another tip :slight_smile:

You can use “depends” utility to see all dependency of the “exe” or “dll”. This utility is a aprt of Visual Studio and can be dowloanded to be used stand-alone too.
dependencywalker.com/

Thanks Valeri,
I was reading about it before, but forgot about it actually.
So after I put also libMatrix.dll into the installer, the application started at least on the target computer, but the Rint/Cint window appeared and gave so many error messages, that I think I gave up now trying to make a stand-alone application (or would it work if I just copy all dlls? But then I might as well people install it fully… (If somebody’s interested I attach the error messages as a text file).
I figured, that with Valeri’s wonderfully working MSI installer package, I could make a prerequisite for the installer pointing to Valeri’s page (if that’s fine? :smiley:) or maybe to mine (to ensure it’s the same version that people will install) and let people install ROOT quickly as it’s so easy nowadays compared to 2 years ago. :wink:
One comment to your website, Valeri:
In the How to ugrade section, I think what you wanted to say is “…you may choose not to uninstall the obsolete one.”(if you want to be so hyper-polite :slight_smile: ) instead of “…you may not have uninstalled the obsolete one.”

Cheers,
Michael
failure.txt (3.43 KB)

MInuit (and Html and Poscript) are currently loaded by TRint unconditionally
(those pre-dates the implementation of the plugin manager). To avoid their loading you currently have to implement your your TRint (or use only TApplication). We shall look wether it is practical to delegate those loading to the plugin manager.

Cheers,
Philippe

[quote=“michaelaye”]In the How to ugrade section, I think what you wanted to say is “…you may choose not to uninstall the obsolete one.”(if you want to be so hyper-polite :slight_smile: ) instead of "…you may not have uninstalled the obsolete one."
Michael[/quote]Thank you, Fixed. I do apperciate your feedback.

So i was following the instructions to try to do the TMuster thing. I got a new error that wasn’t discussed here:

------ Build started: Project: muster, Configuration: Debug Win32 ------
Building ROOT Dictionary
Compiling…
main.cpp
TMuster.cpp
TMusterdict.cpp
c:\documents and settings\daniel mcdonald\desktop\muster\tmusterdict.cpp(54) : error C2664: ‘ROOT::TGenericClassInfo::SetNewArray’ : cannot convert parameter 1 from ‘void *(__cdecl *)(Long_t)’ to 'ROOT::NewArrFunc_t’
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Generating Code…
Build log was saved at "file://c:\Documents and Settings\Daniel McDonald\My Documents\Visual Studio 2005\Projects\muster\muster\Debug\BuildLog.htm"
muster - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Also, is there no easy way to just build a program with the Root dictionaries?? Why is the gcc/cygwin not favored anymore?? It just seems like a makefile would be a lot easier. My goal is to just be able to take a simple GUI i wrote and run it without the interpreter.

Most likely you need to regenerate the dictionary file.

Cheers,
Philippe