Debug Assertion Failed! |
Post Reply |
Author | |||||
tomay3000
Groupie Joined: 08 December 2010 Location: Algeria Status: Offline Points: 56 |
Post Options
Thanks(0)
Posted: 20 December 2010 at 6:35pm |
||||
When I use MFC as Statically Linked Library, a Debug Assertion Failure message box containing the following code in my app::InitInstance appears:
generated debug assertion if (!ProcessShellCommand(cmdInfo)) return FALSE; -- File: docsingl.cpp Line: 215 However when using MFC as Shared DLL, this error is not coming and I'll get my window. I am confused to figure out why !? I have traced out that my program is failing at the big line of the following code: void CSingleDocTemplate::SetDefaultTitle(CDocument* pDocument) { CString strDocName; if (!GetDocString(strDocName, CDocTemplate::docName) || strDocName.IsEmpty()) { // use generic 'untitled' VERIFY(strDocName.LoadString(AFX_IDS_UNTITLED)); } pDocument->SetTitle(strDocName); } If I use the AFX_IDS_UNTITLED in the resource string table & everything goes fine. I don't want to do this. Even if you don't use it in the string table, it should have worked fine. because AFX_IDS_UNTITLED is defined in afxres.h & the resource file uses this header file. Other projects that do not use AFX_IDS_UNTITLED in the string table resource are working fine. So I opened the compiled EXE file with a Resource Editor, I searched for the missing string. I found that is was right there: "sans nom" in FRENCH cause I build my project with FRENCH AppWizard. I recreated my project using the ENGLISH, DEUTCH, SPANISH & ITALIC AppWizard, & figured out that the problem has gone. & I thought that the problem is due to my system: "Windows XP Pro SP3 FRENCH Edition", so I reinstalled the system that time: "Windows XP Pro SP3 ENGLISH Edition", & figured out that all the problems has gone, & all the projects created using the ENGLISH, FRENCH, DEUTCH, SPANISH & ITALIC AppWizard are working perfectly. The problem is that I don't want to install "Windows XP Pro SP3 ENGLISH Edition". Any ideas? Help me Please |
|||||
Product: Codejock ToolkitPro MFC v16.2.0
Platform: Microsoft Windows 8 Pro (64-bit) Language: Microsoft Visual C++ v6.0 (MFC) |
|||||
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
||||
Standard thing. If you compile statically you must add MFC/Toolkit resources to your resources
open res\[app].rc2 file and add line #include "AFXRES.RC"
|
|||||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|||||
tomay3000
Groupie Joined: 08 December 2010 Location: Algeria Status: Offline Points: 56 |
Post Options
Thanks(0)
|
||||
The "afxres.rc" file is already included. Thank you for your help, but I found the solution: Debug Assertion Failed! - Solved I did many tests to reach to this solution. So what did I do!? I created a sample SDI application & named it as FR using the Xtreme ToolkitPro 2009 (13.4.2) AppWizard & I choosed the French (France) (APPWZFRA.DLL) to include French resources, & link the MFC statically. When the project is created, I built it to create the executable file. In the project directory you should see the Debug or the Release folder, depending on your project configuration. Enter that folder, & now you should see an .res file. In my case it's FR.res. I am using Restorator 2007 as my default Resource Editor. So I opened FR.res file using it, & I searched for the string "sans nom" which means "Untitled" in English. I found it in the English (United States) String resources as you see in the image below. But that string & all other French strings should be in the French (France) String resources!!! That’s strange! Now open the .rc file from the main project directory with a text editor. In my case it's FR.rc. & scroll to the end of page, you should see this part of code:
The line:
Should be moved to the end as follows:
This is because, if we open the file FR.rc2 from the res folder, we should see this code:
& the rest of resources inclusion will be appended to the English (United States) resources. Now save the edited FR.rc file & rebuild your project. Then, open again FR.res file with an Resource Editor. Search for the string "sans nom". Now it should be in the French (France) String resources as shown in the image below. That's all. & I hope that you have understood, sorry for my bad English ;) |
|||||
Product: Codejock ToolkitPro MFC v16.2.0
Platform: Microsoft Windows 8 Pro (64-bit) Language: Microsoft Visual C++ v6.0 (MFC) |
|||||
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |