Nonzero exit codes from VC 9.0 program/library


I am trying to migrate to a Windows Vista 64-bit machine after having (successfully) used ROOT for a long time on a Windows XP machine. My ROOT version is still 5.20.00, my compiler is still VC++ 9.0, and my code certainly has not changed.

However I get a nonzero exit code (according to “echo %errorlevel%”) after the program has finished running (successfully), which causes Vista to complain that the program has had an abnormal exit. Is this “normal” somehow? Even a “hello world” program does this. How do I stop this behavior? It gets extremely annoying… I’m pretty sure it is not a fault with my code, since the same program runs fine with 0 exit code on Linux boxes. Perhaps it is a fault with my VC++ project configuration, although I only chose the default console project option (plus adding all the ROOT include paths and libraries of course).

Any tips would be much appreciated,

Sue Ann Koay

Hello Sue Ann,

I also have Vista x64 and MSVC++9.0 and I don’t see this problem…
Does ROOT itself gives the message? (or only your application)?

Cheers, Bertrand.

It is the application that causes the problem. There is no error message.

Anyway, I think I have localized the problem: I am trying to make a class with a CINT library, and the LinkDef.h option of using the “new I/O system”, via:

#pragma link C++ class HelloWorld+;

The crash stops when I instead do:

#pragma link C++ class HelloWorld;

The code files are attached in case somebody knows why. It is a really simple test program.
LinkDef.h (85 Bytes)
HelloWorld.h (193 Bytes)
HelloWorld.cpp (99 Bytes)

I don’t have any problem with your code and svn trunk version of root… Now, the problem may come from the way you build your application (e.g. compilation flags)
Could you try your example with its makefile as in the attachement and let me know, please?
Unzip it somewhere, and then, from a Visual Studio command prompt: cd HelloWorld nmake
This will generate test.exe and it should work (note that ROOTSYS and PATH must be properly set)

HelloWorld.tar.gz (1.86 KB)

I had to wait for a while until I had time to follow this up, because when I tried to comple your tarball as instructed, nmake returns the following error:

mt.exe : general error c101008d: Failed to write the updated manifest to the resource of file “test.exe”. The binary is not a valid Windows image.
NMAKE : fatal error U1077: ‘“C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\mt.EXE”’ : return code '0x1f’

Unfortunately I don’t know why… I believe I have the Visual Studio environment set properly, as well as the ROOT path. The output is below if you can help…


Setting environment for using Microsoft Visual Studio 2008 x86 tools.

C:\Software\Development\VisualStudio\VC>cd C:\Users\sakoay\Desktop\HelloWorld.tar\HelloWorld


Microsoft ® Program Maintenance Utility Version 9.00.30729.01
Copyright © Microsoft Corporation. All rights reserved.

No configuration specified: Defaulting to Win32 Release
With Release Runtime DLL (Taken from ROOT config).
cl -nologo -EHsc -GR -DWIN32 -W3 -D_WINDOWS -DVISUAL_CPLUSPLUS -IC:\Software\Framework\root/include -wd4244 -FIw32pragma.h -D_CRT_SECURE_NO_DEPRECATE
-O2 -arch:SSE2 -MD -c HelloWorld.cxx
"Generating dictionary HelloWorldDict.cxx…"
cl -nologo -EHsc -GR -DWIN32 -W3 -D_WINDOWS -DVISUAL_CPLUSPLUS -IC:\Software\Framework\root/include -wd4244 -FIw32pragma.h -D_CRT_SECURE_NO_DEPRECATE
-O2 -arch:SSE2 -MD -c HelloWorldDict.cxx
link -nologo -incremental:no -opt:ref HelloWorld.obj HelloWorldDict.obj C:\Software\Framework\root/lib/libCore.lib C:\Software\Framework\root/lib/libC
int.lib C:\Software\Framework\root/lib/libHist.lib C:\Software\Framework\root/lib/libGraf.lib C:\Software\Framework\root/lib/libGraf3d.lib C:\Software\Fram
ework\root/lib/libGpad.lib C:\Software\Framework\root/lib/libTree.lib C:\Software\Framework\root/lib/libRint.lib C:\Software\Framework\root/lib/libPostscr
ipt.lib C:\Software\Framework\root/lib/libMatrix.lib C:\Software\Framework\root/lib/libPhysics.lib C:\Software\Framework\root/lib/libNet.lib C:\Software\Fr
amework\root/lib/libRIO.lib C:\Software\Framework\root/lib/libMathCore.lib -out:test.exe
Creating library test.lib and object test.exp
mt -nologo -manifest test.exe.manifest -outputresource:test.exe;1

mt.exe : general error c101008d: Failed to write the updated manifest to the resource of file “test.exe”. The binary is not a valid Windows image.
NMAKE : fatal error U1077: ‘“C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\mt.EXE”’ : return code '0x1f’

C:\Users\sakoay\Desktop\HelloWorld.tar\HelloWorld>echo %ROOTSYS%

C:\Users\sakoay\Desktop\HelloWorld.tar\HelloWorld>echo %PATH%
soft.NET\Framework\v3.5;C:\Windows\Microsoft.NET\Framework\v2.0.50727;C:\Software\Development\VisualStudio\VC\VCPackages;C:\Program Files\Microsoft SDKs\Windows


I’m puzzled… I don’t see how it could not be a valid Windows image…
Can you try to run test.exe?
Otherwise, can you try to remove the $(MT_MANIFEST) line from the Makefile and try again?