Solved

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

Posted on 2010-08-23
5
1,426 Views
Last Modified: 2012-05-10
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.
0
Comment
Question by:Snapples
5 Comments
 
LVL 40

Expert Comment

by:evilrix
ID: 33503517
>> 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

0
 
LVL 2

Author Comment

by:Snapples
ID: 33503613
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.
0
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 33503652
Since you mention explicitly "when I'm trying to run my application without the debugger" the reason is most likely an uninitialized variable, since when running under the VS debugger, all variables are explicitly initialized. I'd start double checking that.
0
 
LVL 40

Expert Comment

by:evilrix
ID: 33504135
>> 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?
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33504430
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.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question