简体   繁体   中英

C++ MFC Debug Assertion Failed! in static MFC

Debug Assertion Failed!
File: f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\objcore.cpp Line: 40

I'm having this issue when I'm trying to DoModal(or Create) MFC window using debug configuration - Use MFC in a Static Library and Dynamic Library (.dll) . On Release configuration everything is OK but I can't debug dll. MS VS 2010

It does not happen in the release build, since code is using ASSERT that has no meaning in the release build. ASSERT is a debug tool.

It may be a surprise to you but MFC does not use Windows modal dialog. Calling Create or DoModal creates windows modeless dialog. MFC achieves modality by disabling a parent window (if any) and supplies dialog with own message handling loop similar to application message loop.

That is why tou have the same result regardless of using Create or DoModal.

Does it happen before dialog is even shown?

The error you show in your post indicates that somewhere in your app code you are trying to use an object that has not been instantiated and is NULL during dialog initialization. It seems like it fails IsKindOf check.

Would it be possible to zip your project and post it for us do debug it?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM