Microsoft KB Archive/85496

= PRB: Assertion Failed: WINAPP.CPP, APPCORE.CPP, or WINMAIN.CPP =

Article ID: 85496

Article Last Modified on 11/21/2006

-

APPLIES TO

 Microsoft Foundation Class Library 4.2, when used with:  Microsoft Visual C++ 1.0 Professional Edition

 Microsoft Visual C++ 1.5 Professional Edition

 Microsoft Visual C++ 1.0 Professional Edition

 Microsoft Visual C++ 2.0 Professional Edition</li></ul>

 Microsoft Visual C++ 2.1</li></ul>

 Microsoft Visual C++ 4.0 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q85496

<div class="notice_section">

<div class="symptoms_section">

SYMPTOMS
Running a Microsoft Foundation Classes (MFC) application developed with Microsoft C/C++ version 7.0 or Visual C++ for Windows may cause one of the following error messages to be displayed:

Assertion failed - :File winapp.cpp, Line 258

-or-

Assertion failed - :File appcore.cpp, Line 602

Running a MFC application developed with Visual C++, 32-bit Edition, version 1.0 may cause the following error message to be displayed:

Assertion failed - :File appcore.cpp, Line 559

Running a MFC application developed with Visual C++, 32-bit Edition, version 2.x, may cause the following error message to be displayed:

Assertion failed - :File winmain.cpp, Line 40

Running a MFC application developed with Visual C++, 32-bit Edition, version 4.0, may cause the following error message to be displayed:

Debug Assertion Failed!

Program: <program_name>

File: winmain.cpp

Line: 34

NOTE: In Visual C++, 32-bit Edition, versions 2.0 and above, the assertion will be followed by an Application Error.

<div class="cause_section">

CAUSE
The assertion that fails is the check to see whether an application object exists. Without the application object, the program cannot run.

<div class="resolution_section">

RESOLUTION
Define an object of a class derived from the CWinApp class.

<div class="moreinformation_section">

MORE INFORMATION
An example of this error may be seen by commenting out the file scoped statement of any MFC application that defines the CWinApp-derived object. This statement will look similar to the following: CMyWinApp MyWinApp; where CMyWinApp is defined as follows: class CMyWinApp : public CWinApp {     //...   }; For an example MFC application, see the HELLOAPP sample program included with any of the Microsoft products listed above. Chapter 3 of the &quot;Microsoft C Class Libraries User's Guide,&quot; provided with Microsoft C/C++ version 7.0, and chapter 1 of the &quot;Programming with MFC: Overview,&quot; included in the Visual C++ Books Online, contain additional information on CWinApp and on the fundamentals of using the Microsoft Foundation Classes to build an application for Windows.

Additional query words: 7.00 1.00 1.50 2.00 2.10 2.50 3.00 4.00

Keywords: kbprb KB85496

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.