Compiling stand alone app under Win using comand prompt

Dear Rooters,

at the moment i try to get my programs which i have written under a linux environment running under windows.
I am using Visual Express Studio 2010 and i have made it to compile and run the most of my stuff using the IDE.
But i want to write my code with an text editor (vi) and do compiling in an command prompt as i have done in in linux.
In Linux i have used g++ and there the build process is more or less simple.
But now in windows i have no idea where to begin.
I took a look into the makefile which you can find in root/test/ which was recommended in some topics here.
But i am afraid that i need a little more advice where to start, maybe write an own makefile.
I would be very grateful for some advices here.

Cheers
Jo

Hi,

There is an example of native win32 nmake makefile there: $ROOTSYS/test/Makefile.win32

You can also use directly cl (as you did with g++). For example, in debug mode:

and the same in Release (optimized) mode:

And note that you can’t mix debug & release builds (i.e. use the same config than root itself)

Cheers, Bertrand.

Hi Bertrand,

thanks for your reply.
I’ve tried what you recommended, but the linker shows an error, that i have to define the entry point.
What i don’t understand is, that it runs when i use the visual express ide, but i am messing around since a while with compiling in command and don’t realy understand what i am doing wrong.
I think i miss to tell the compiler something he wants to know but i don’t know what.
The program which i try to compile is with an graphical user interface.
With rootcint i have created the dictionary file but in the lines you suggested i don’t see where the compiler got told that there is this file.

Cheers
Johannes

Hi,

First create the dictionary:

 rootcint -f yourDict.cxx -c yourHeader.h LinkDef.h

Then build (first syntax):

 cl -nologo -Z7 -MDd -GR -EHsc -I%ROOTSYS%\include -FIw32pragma.h sourceFile.cxx yourDict.cxx /link -debug %ROOTSYS%\lib\libCore.lib %ROOTSYS%\lib\libCint.lib %ROOTSYS%\lib\libGui.lib /out:yourprogram.exe

Or build (second syntax):

 cl -nologo -Z7 -MDd -GR -EHsc sourceFile.cxx yourDict.cxx -I %ROOTSYS%\include /link -debug -LIBPATH:%ROOTSYS%\lib libCore.lib libCint.lib libGui.lib

Or simply create a nmake makefile (you can also take a look at $ROOTSYS/test/RootShower/Makefile.win32)

Cheers, Bertrand.

Hi Bertrand,

thanks for fast support.
Now my linker complains that he can’t resolve external symbols.
He complains about every root class i included also about all classes i have written by my own.

Cheers
Johannes

Oh yes, indeed, I forgot to tell: you obviously have to add the needed libraries in the list (I only show libCore, libCint and libGui)…
Cheers, Bertrand.

Hi Bertrand,

i understand, i will include them and tell what happened afterwards.

Cheers and many thanks :slight_smile:
Johannes

Hi Bertrand,

i have done what you said, but the linker is still complaining about unresolved external symbols.
But as i can see its only the classes which i have written by my own.
For these i don’t have .lib files.
Do you have any clue how i can solve this?

Cheers
Johannes

Hi Johannes,

Well, I’m a bit confused… Where are your classes? in source files, right? Then you have to compile the source files (.cxx) containing your classes (add them in the list of source files…)
Or create a makefile (that you can re-use for any other project)

Cheers, Bertrand.

Hi Bertrand!

It works now.
I think know i can start looking into makefile by my own because i have now something to start from.
You helped my a lot.
Thanks for your help and patience! =D>

Cheers
Johannes

Hi Johannes,

You’re welcome! And glad to see you finally managed to build it! :smiley:

Cheers, Bertrand.