ROOT libraries and windows

Hi, I’m super new with c++ and root and I need your help.
I’m using windows and I installed MinGW and ROOT and I can use them separately (that means that I can compile and execute a c++ programm and I can open ROOT and work with it), the problem is when I have to use them togheter: I use the prompt script to make the programm compile and execute, but I don’t know how to link libraries in windows. How can I do that?
Sorry for my silly questions, but it’s a completely new field for me.
Thanks for your help, and if I havven’t been clear, I’ll try to explain better.

Hi,

What do you mean? Which prompt script? Which program?

And how to link with ROOT libraries depends on your build system. There a couple of makefile in $(ROOTSYS)/test (Makefile.win32 is to be used with nmake in a command prompt), but note we don’t use MingW…

And if you have a concrete example, that would help us to understand the problem you have.

Cheers, Bertrand.

Thank you!
Well, I’m using an MS-DOS window to compile.
When I do this in Linux I write:

c++ -o test ´root-config --cflags --glibs´ test.cpp

but I don’t know how to do this in windows.

Is it better not to use MinGW? What do you suggest instead? I have to write a c++ file that can be compiled on a Linux computer.
Thank you again for your help, I’m really new at this.
Ure

Hi,

So here is an example, to be used with the release (optimized) build of Root:

cl -MD -EHsc -TP test.cpp -I%ROOTSYS%\include -FIw32pragma.h /link -LIBPATH:%ROOTSYS%\lib libCore.lib libGraf.lib libGPad.lib libHist.lib libRint.lib libRIO.lib libTree.lib libGui.lib
And the same, to be used with the debug build of Root:

cl -MDd -EHsc -TP test.cpp -I%ROOTSYS%\include -FIw32pragma.h /link -debug -LIBPATH:%ROOTSYS%\lib libCore.lib libGraf.lib libGPad.lib libHist.lib libRint.lib libRIO.lib libTree.lib libGui.lib
And add missing libraries if needed…

You can also create a nmake Makefile, taking as example $(ROOTSYS)/test/Makefile.win32.
It is easy to test: Just open a Visual Studio Command prompt, cd $(ROOTSYS)/test an type “nmake -f Makefile.win32”

Cheers, Bertrand.

Thanks