Solved

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

Posted on 2010-08-23
5
1,460 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

623 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