By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,680 Members | 1,436 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,680 IT Pros & Developers. It's quick & easy.

runtime error, help

P: n/a
I am working on converting a win32 console application from VC6 to VC7.

My version is Microsoft Development Environment 2003 version 7.1.3088.

The code works fine on VC6. it is a console program for scientific
computation, so it has nothing to do with MFC. But it needs some
other libraries such as MKL, sparselib, etc.

VC7 can build the executable successfully. However, when i run it,
there is only one line on the command window:

"runtime error Press any key to continue"

No other complain/information about it. This happens for both debug
and release versions.

----
I solved two problems before being stuck by this runtime error.

1. cl : Command line error D2004 : '/I' requires an argument
solve: manu -> project -> property pages -> C/C++ -> command lines
-> remove /I

2. Command line error D2016 : '/RTC1' and 'O2' command-line options
are incompatible.
solve: changing the AppName.vcproj file by replacing all BasicRuntime-
Checks="3" with BasicRuntimeChecks="0"

I left one warning unsolved:
LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:
ICF' specification
I know I provided very limited information about the runtime error. But
that's
all i got. Any guide to solve this error is indeed appreiated !

Happy New Year!

Yuanlin

Dec 29 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Its a very basic question - where did it crash during the debugging
process ? Are you able to debug it successfully while it crashes only
running standalone ?
The /I is for include search path. As the code compiled, this can be
harmless (unless and until there is some configuration #defines which
were missed because of illegal directories)
If the compiler mentions a mismatch between /RTC1 and /O2 - then there
is very little you can do about it. You can stick with one of the
options. Also another thing you can try is turn off optimizations and
see if the app runs fine.
And the /EDITANDCONTINUE is fairly harmless.
I will suggest you running it under the debugger and also to turn of the
optimizations and see if things work fine.

yu**********@gmail.com wrote:
I am working on converting a win32 console application from VC6 to VC7.

My version is Microsoft Development Environment 2003 version 7.1.3088.

The code works fine on VC6. it is a console program for scientific
computation, so it has nothing to do with MFC. But it needs some
other libraries such as MKL, sparselib, etc.

VC7 can build the executable successfully. However, when i run it,
there is only one line on the command window:

"runtime error Press any key to continue"

No other complain/information about it. This happens for both debug
and release versions.

----
I solved two problems before being stuck by this runtime error.

1. cl : Command line error D2004 : '/I' requires an argument
solve: manu -> project -> property pages -> C/C++ -> command lines
-> remove /I

2. Command line error D2016 : '/RTC1' and 'O2' command-line options
are incompatible.
solve: changing the AppName.vcproj file by replacing all BasicRuntime-
Checks="3" with BasicRuntimeChecks="0"

I left one warning unsolved:
LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:
ICF' specification
I know I provided very limited information about the runtime error. But
that's
all i got. Any guide to solve this error is indeed appreiated !

Happy New Year!

Yuanlin

Dec 29 '05 #2

P: n/a

If the application still terminates silently even when running under debugger,
set breakpoint at abort() and at ntdll!NtTerminateProcess functions.
When the breakpoint is hit, take a look at the call stack to find out who is trying
to terminate the application.

To set breakpoint at ntdll!NtTerminateProcess, use the following expression
in New Breakpoint dialog:

{,,ntdll.dll}_NtTerminateProcess@8

It will require symbols for ntdll.dll, you can use symbol server to download them:
http://msdn.microsoft.com/library/en...mbolServer.asp

Regards,
Oleg
[VC++ MVP http://www.debuginfo.com/]

Dec 29 '05 #3

P: n/a
Thanks, Gangadhar, Oleg,

Just as Oleg said, the program terminates silently when running under
debugger, even i set a breakpoint at very beginning of the code.

It gives out messages like this: (GPRS2P.exe is my app name)

'GPRS2P.exe': Loaded 'E:\MyWorkingDir\GPRS2P.exe', Symbols loaded.
'GPRS2P.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols
loaded.
'GPRS2P.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols
loaded.
'GPRS2P.exe': Loaded 'C:\WINDOWS\system32\mkl_support.dll', No symbols
loaded.
The program '[1540] GPRS2P.exe: Native' has exited with code 255
(0xff).

I followed the instruction of Oleg and setup a breakpoint for
{,,ntdll.dll}_NtTerminateProcess@8 (I think this is a function), and
set path as :symsrv*symsrv.dll*c:\localcache*http://msdl.microsoft.
com/download/symbols

However, it seems that the breakpoint is not hitted. I did not find
any downloaded file in folder c:\localcache. Program quits directly
and shows the same messages.

Yuanlin

Dec 29 '05 #4

P: n/a
btw: when i setup the breakpoint, I use "function" tab page,

Function: {,,ntdll.dll}_NtTerminateProcess@8
Line: 1
Character: I
Language: Unknown (if i choose C++, it complains that "IntelliSense
could not find the specified location" ).

Dec 29 '05 #5

P: n/a
so, the application dies even before it starts up. Are there any global,
static initializers (constructors) that do some sort of processing ?
Take a look at these initializers to see if there is something wrong
going on in there.
Also, when you run under the windbg, see if you can single step (even if
it is disassembly) and look for any jmp to invalid addresses.

yu**********@gmail.com wrote:
btw: when i setup the breakpoint, I use "function" tab page,

Function: {,,ntdll.dll}_NtTerminateProcess@8
Line: 1
Character: I
Language: Unknown (if i choose C++, it complains that "IntelliSense
could not find the specified location" ).

Dec 30 '05 #6

P: n/a
Just as Oleg said, the program terminates silently when running under
debugger, even i set a breakpoint at very beginning of the code.

It gives out messages like this: (GPRS2P.exe is my app name)

'GPRS2P.exe': Loaded 'E:\MyWorkingDir\GPRS2P.exe', Symbols loaded.
'GPRS2P.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols
loaded.
If everything is configured properly, the breakpoint should be hit even if NtTerminateProcess
is called e.g. from a constructor of a global object. The problem is that symbols for ntdll.dll
are not loaded, so probably there is something wrong with symbol server configuration.
'GPRS2P.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols
loaded.
'GPRS2P.exe': Loaded 'C:\WINDOWS\system32\mkl_support.dll', No symbols
loaded.
The program '[1540] GPRS2P.exe: Native' has exited with code 255
(0xff).

Additionally, this output shows that there is no unhandled exception, but someone
calls abort() or ExitProcess() on purpose.
I followed the instruction of Oleg and setup a breakpoint for
{,,ntdll.dll}_NtTerminateProcess@8 (I think this is a function), and
set path as :symsrv*symsrv.dll*c:\localcache*http://msdl.microsoft.
com/download/symbols


I would recommend to resolve the symbol server configuration problem,
then the breakpoint should be hit.

Try the following:

1. Download and install the latest Debugging Tools for Windows:
http://www.microsoft.com/whdc/ddk/de...g/default.mspx

2. Copy symsrv.dll from the installation directory of Debugging Tools
to <VSInstallDir>\Common7\IDE directory (overwrite the old symsrv.dll
if it exists there).

3. Set the following setting in your project settings:
Project properties | Configuration Properties | Debugging | Symbol Path
to the following:
srv*c:\localcache*http://msdl.microsoft.com/download/symbols
(alternatively, you can set _NT_SYMBOL_PATH environment variable
to the same value, then any project will pick up the symbol server path
after system restart).

4. Run the project again and see if symbols get loaded.

If this still does not help (symbols do not get loaded), you can check the following option
in VS settings:
Tools | Options | Debugging | Native | Load DLL exports
and change the expression used to set the breakpoint to the following:
{,,ntdll.dll}NtTerminateProcess

Then the breakpoint should hit even without symbols, though resulting call stack
can be worse than in the case with good symbols.

Oleg

Dec 30 '05 #7

P: n/a
I followed Oleg's elaborate instruction, and it works. The size of old
version of symsrv.dll is about 37k and the new one is 112k.

The breakpoint at _NtTerminateProcess@8 is hit and the call stack shows
below messages:
--------------------------------------------
ntdll.dll!_NtTerminateProcess@8()
kernel32.dll!__ExitProcess@4() + 0x37
kernel32.dll!7c81cab6()
GPRS2P.exe!__crtExitProcess(int status=255) Line 464 C
GPRS2P.exe!doexit(int code=255, int quick=1, int retcaller=0) Line 414
+ 0x9 C
GPRS2P.exe!_exit(int code=255) Line 311 + 0xd C
GPRS2P.exe!_amsg_exit(int rterrnum=589855) Line 321 + 0xb C
GPRS2P.exe!mainCRTStartup() Line 231 + 0x9 C
kernel32.dll!_BaseProcessStart@4() + 0x23
---------------------

By tracing the code, the problem is located at:
mainCRTStartup(){ ...
initret = _cinit(TRUE);
if (initret != 0)
_amsg_exit(initret);
...
}

By checking the whole program, I found the error comes from DFOR.LIB.
(My code needs the library, but I dont have digital fortran installed
on my mechine. So I insert the lib file explicitly in my project.)

There are two versions of DFOR.lib. The size of the one used to work
in VC6 is about 789k. It causes all the problem. After replacing it
with a new one (864k, however, I dont know which one is really "new"),
the problem works as good as it should be.

I would like to thank you guys for your kind help!

Happy New Year !

Yuanlin 1/1/2006

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Jan 1 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.