Solved

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

Posted on 2010-08-23
5
1,446 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

710 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