Link to home
Start Free TrialLog in
Avatar of Snapples
Snapples

asked on

This application has requested the runtime to terminate it in an unusual way

I'm getting this error when I'm trying to run my application without the debugger. The Microsoft help site says this:

This problem may occur when you use the /GR and the /MD compiler switches, and the version of the Msvcrt.dll file and of the Msvcirt.dll file is 7.0.x.

There is a hotfix for Windows XP but there's no solution for anything else (I use Windows 7). Also, I can't just ship a hotfix along with it.
I don't really know much about compiler switches, how do I compile this program and have this error go away?

I'm using Visual Studio 2008, this is my command line:

/Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MDd /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /nologo /c /ZI /TP /errorReport:prompt

Open in new window



Thanks in advance.
Avatar of evilrix
evilrix
Flag of United Kingdom of Great Britain and Northern Ireland image

>> This problem may occur when you use the /GR and the /MD compiler switches, and the version of the Msvcrt.dll file and of the Msvcirt.dll file is 7.0.x.

I wouldn't read too much into that... there are plenty of reasons why your code could be generating this error. The main one is that the code has thrown an exception and it has not been caught or handled.

The following tiny bit of code demonstrates this.
int main()
{
	throw 0;
}

Open in new window

Avatar of Snapples
Snapples

ASKER

Well, I have try catch blocks everywhere in my program, also at the start, but I get the runtime error before it even gets there.
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>> Well, I have try catch blocks everywhere in my program

Well that's not the only reason you might get the error - it was more an example of the fact that the MSDN article is probably a red-herring. Also, where you say you have catch blocks - what exactly are you catching?

You should also check what jkr suggests. Also, newer versions of Visual Studio instrument code with buffer overflow checks and can be the cause of such errors.

Out of interest are you running release or debug versions of the code? How do they both run in the debugger? How do they both run if you have no debugger attached?
Just a moment. The command line you posted generates the debug version. How I understand you have problem with the release build. If you have a mistake in the project settings, in the release configuration, the application will crash.