GUI compilation under MSVS .NET 2003/ ROOT 5.14 / Windows XP

Having once again to move from an UNIX setup to a Windows setup, I once again run against compilation problems. I would really appreciate if the Windows-ROOT gurus could give me a helpful hand.

Here is the background: I am trying to compile and run a ROOT GUI application within Microsoft Visual Studio .NET 2003.
I have no particular trouble when compiling custom classes: the .dll files are correctly generated, and I can load them from ROOT.

However, when I try to compile a standalone program with a GUI, it directly crashes into oblivion.

The configuration is set up as follows:
I am trying (for instance) to compile guitest.cxx which is in subdirectory test of the standard ROOT distribution.

Environment variables:

%ROOTSYS%: P:\root

MSVS configuration: Compiler options:

/Od /Ob1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /GF /FD /EHsc /MD /Gy /YX"stdafx.h" /Fp".\Release/GUItest3.pch" /Fo".\Release/" /Fd".\Release/" /W0 /nologo /c /TP  /Ze /GX

MSVS configuration: Linker options:

/OUT:".\Release/GUItest3.exe" /INCREMENTAL:NO /NOLOGO /PDB:".\Release/GUItest3.pdb" /SUBSYSTEM:WINDOWS /ENTRY:"main" /MACHINE:X86 libCore.lib libCint.lib libHist.lib libGraf.lib libGraf3d.lib libGpad.lib libTree.lib libRint.lib libPostscript.lib libMatrix.lib libPhysics.lib libGui.lib odbc32.lib odbccp32.lib MSVCPRT.LIB  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

The program crashes with access violation error code (0xC0000005)

I am quite puzzled about these results. The solution would seem to be in a compilation option or an missing environment variable, but I am a bit lost. The worst of it is that the behaviour seems to be random: sometimes, the program starts correctly - without any recompilation. But most of the times, it fails.

Thanks a lot for any help,

Edit: and please do not mind about this post being in the wrong subsection of the forum - my finger probably slipped when I clicked in. :wink:


Could you send me ( the whole project in a tar file, I think it will be faster to solve your problem this way :wink:


Bertrand pointed out two mistakes in my current configuration:

In the compiler options, RTTI (/GR) was not enabled.
(this is documented everywhere :blush:)

In the linker options, I am specifying WINDOWS as the subsystem (/SUBSYSTEM:WINDOWS). In this case, the entry point must be set as mainCRTStartup (/ENTRY:“mainCRTStartup”) instead of just “main”.

Everything works now, thanks a lot. :slight_smile: