Compiling ROOT code using external compiler on Windows

Dear all,

I would like to ask for help with compiling ROOT code using external compiler on Windows (Win7 x64 in my case). I don’t know if this topic fits in here, but I saw that some time ago MS Win32 solution for CINT has been provided in this board, but the links are dead. I have spent a lot of time searching the web for a solution but nothing worked for me.

So far I have been working in ROOT using notepad++ and ROOT cmd.exe-style console which was sufficient until I started to write codes over 3000 lines. What I am looking for now is writing ROOT code in some IDE (Eclipse, Visual Studio, it does not really matter) with full code completion, compilation using external compiler (VC9, MinGW, does not really matter), library linking and producing binaries/dlls under Windows. This is useful mainly because the IDE finds errors which ROOT CINT just overlooks (like undeclared variables etc.) and then your whole macro starts acting funny …

Now the problem is I was never able to make this work completely. For example Eclipse project with included headers does code completion, but does not compile to produce a binary (only produced .o objects). In this case it appears the linker is able to find the libraries (all include paths and library paths are correct), but then horribly fails when attempting to link them. A small sample of the error log:

Source\Style_ATLAS_PRAGUE.o:D:\Documents\Projects\Eclipse\CPPM_Datachecks\Debug/…/Source/Style_ATLAS_PRAGUE.cxx:310: first defined here
Source\Style_ATLAS_PRAGUE.o:Style_ATLAS_PRAGUE.cxx:(.text+0x30): undefined reference to TStyle::TStyle(char const*, char const*)' Source\Style_ATLAS_PRAGUE.o:Style_ATLAS_PRAGUE.cxx:(.text+0xd7): undefined reference toTColor::CreateGradientColorTable(unsigned int, double*, double*, double*, double*, unsigned int)'
Source\Style_ATLAS_PRAGUE.o:Style_ATLAS_PRAGUE.cxx:(.text+0xea): undefined reference to TStyle::SetNumberContours(int)' Source\Style_ATLAS_PRAGUE.o:Style_ATLAS_PRAGUE.cxx:(.text+0x1a8): undefined reference toTStyle::SetOptStat(int)'
Source\Style_ATLAS_PRAGUE.o:Style_ATLAS_PRAGUE.cxx:(.text+0x1bb): undefined reference to TStyle::SetOptFit(int)' Source\Style_ATLAS_PRAGUE.o:Style_ATLAS_PRAGUE.cxx:(.text+0x260): undefined reference toTStyle::SetPaperSize(float

If you want to check my code, here are the links.
Eclipse C++ project with included headers and libraries: dl.dropbox.com/u/4567044/CPPM_Datachecks.zip
Plaintext Makefile and code: dl.dropbox.com/u/4567044/CPPM_Da … kefile.zip

If anybody has any suggestion on how to do things with ROOT compilation on Windows, just pick your favourite way and show me? If you have working solutions for Visual Studio with VC9, thats fine. Or maybe Eclipse CDT configuration with MinGW? Or just makefiles for MinGW? Also fine. I am willing to accept anything that would give me code completion and compilation.

If you have anything, please let me know, after weeks at this I am starting to get desperate …

Cheers,

Martin

Hi,

I think there are a few issues.

First, the gcc/g++ that comes with Cygwin has made a lot of advances since it was first used to compile root. Code compiled with gcc will be slower than VC++, but I find that the environment is much more similar to linux (I was able to compile the CMS event display with gcc, but nobody has been able to with VC++). I have makefiles that work seamlessly on both cygwin/gcc and linux.

Second, whether you use an IDE or just a good C++ editor, either will help a lot. Personally I use emacs which has a lot of good features and understands C++ well. VIM and even notepad++ also both work well.

Finally, yes, if you compile your code you are much more likely to find bugs than if you run it interactively in CINT. But that’s easy enough to do inside Root itself if you want (e.g., .L macroToBeCompiled.C+).

Hope this helps,
Charles

[quote=“mzeman”]Dear all,

I would like to ask for help with compiling ROOT code using external compiler on Windows (Win7 x64 in my case). I don’t know if this topic fits in here, but I saw that some time ago MS Win32 solution for CINT has been provided in this board, but the links are dead. I have spent a lot of time searching the web for a solution but nothing worked for me.

So far I have been working in ROOT using notepad++ and ROOT cmd.exe-style console which was sufficient until I started to write codes over 3000 lines. What I am looking for now is writing ROOT code in some IDE (Eclipse, Visual Studio, it does not really matter) with full code completion, compilation using external compiler (VC9, MinGW, does not really matter), library linking and producing binaries/dlls under Windows. This is useful mainly because the IDE finds errors which ROOT CINT just overlooks (like undeclared variables etc.) and then your whole macro starts acting funny …

Now the problem is I was never able to make this work completely. For example Eclipse project with included headers does code completion, but does not compile to produce a binary (only produced .o objects). In this case it appears the linker is able to find the libraries (all include paths and library paths are correct), but then horribly fails when attempting to link them. A small sample of the error log:

Source\Style_ATLAS_PRAGUE.o:D:\Documents\Projects\Eclipse\CPPM_Datachecks\Debug/…/Source/Style_ATLAS_PRAGUE.cxx:310: first defined here
Source\Style_ATLAS_PRAGUE.o:Style_ATLAS_PRAGUE.cxx:(.text+0x30): undefined reference to TStyle::TStyle(char const*, char const*)' Source\Style_ATLAS_PRAGUE.o:Style_ATLAS_PRAGUE.cxx:(.text+0xd7): undefined reference toTColor::CreateGradientColorTable(unsigned int, double*, double*, double*, double*, unsigned int)'
Source\Style_ATLAS_PRAGUE.o:Style_ATLAS_PRAGUE.cxx:(.text+0xea): undefined reference to TStyle::SetNumberContours(int)' Source\Style_ATLAS_PRAGUE.o:Style_ATLAS_PRAGUE.cxx:(.text+0x1a8): undefined reference toTStyle::SetOptStat(int)'
Source\Style_ATLAS_PRAGUE.o:Style_ATLAS_PRAGUE.cxx:(.text+0x1bb): undefined reference to TStyle::SetOptFit(int)' Source\Style_ATLAS_PRAGUE.o:Style_ATLAS_PRAGUE.cxx:(.text+0x260): undefined reference toTStyle::SetPaperSize(float

If you want to check my code, here are the links.
Eclipse C++ project with included headers and libraries: dl.dropbox.com/u/4567044/CPPM_Datachecks.zip
Plaintext Makefile and code: dl.dropbox.com/u/4567044/CPPM_Da … kefile.zip

If anybody has any suggestion on how to do things with ROOT compilation on Windows, just pick your favourite way and show me? If you have working solutions for Visual Studio with VC9, thats fine. Or maybe Eclipse CDT configuration with MinGW? Or just makefiles for MinGW? Also fine. I am willing to accept anything that would give me code completion and compilation.

If you have anything, please let me know, after weeks at this I am starting to get desperate …

Cheers,

Martin[/quote]

Maybe what you want to do is build application on windows that linked to ROOT system. Is that right? Actually build ROOT system itself on windows is none sense. As there is binary version for windows. Build application linkded with ROOT is not complex ,I used the free version of Mircosoft compiler VC++2010 express. Just add a few directory to path and add library dependences,It is ok to compile application with ROOT, The application will run without ROOT except invode ROOT DLLs.

Hi all,

so after a few weeks of research, I found out how make it work. I have investigated a few typical use-cases, and made a tutorial TWiki: www-hep2.fzu.cz/twiki/bin/view/A … owsRelated

Any feedback is welcome.

Cheers,

Martin

Your link is died: http://www-hep2.fzu.cz/twiki/bin/view/ATLAS/WindowsRelated

Could you please reupload it? I need to solve the same problem.

Thank you.