-
April 18th, 2004, 08:45 PM
#1
Problems with MFC's .exe
Greetings everyone,
I have written a program for my project using the MFC (exe). I could run my program perfectly using the debug mode. Then I copied the exe (release) out and pasted it in the other places (with all the database and components needed added in the same directory). So next I clicked on the exe and my program started loading. Everything works fine but when I clicked on one of my functions, error message coming out, the whole program crashes or something.
For that function I'm doing a shortest path algorithm. I am using a database (.mdb) to search for the shortest path. I believe the problem is either cannot link to database or when I click on the nodes, the exe cannot read the value of the node. But it all works fine in my program(i.e. in the debug mode). Anyone has any idea what the problem is and how to solve it?
Any suggestion or solution is appreciated.
Cheers.
-one-
-
April 19th, 2004, 02:45 AM
#2
Could the problem come from the database accessing. I'm using ODBC format. But when I run my program in debug mode, I can run perfectly. This really amuse me. Could anyone tell me is there any difference between the debug version and the release version??
Thank you for any comment.
Cheers
-one-
-
April 19th, 2004, 02:56 AM
#3
maybe the problem is the connect string which you used to open the database.
note that the filename of the database is base on current directory ( which may not be the location where the exe file lies).
-
April 19th, 2004, 03:03 AM
#4
Take a look at the following FAQ. In addition:
-
April 19th, 2004, 03:05 AM
#5
I have every of my database in the same directory. If I use the debug version exe to run, I don't have any problem. But when I use the release version exe, I cannot run the function. I think it has something to do with the mfc42.dll and odbc32.dll. Maybe windows XP isn't compatible with this old ODBC format database? I have no single clue.
What's your opinion??
Thanks alot wuyh.
Cheers.
-one-
-
April 19th, 2004, 03:08 AM
#6
Thanks alot Andreas Masurs. I will look through it and try to find out the problem.
cheers.
-one-
-
April 19th, 2004, 03:41 AM
#7
I still cannot get the problem solved. I tried to find the crash information from the MAP file, but the address that I found is from a function that I never use (which means I just leave it there and there's no even any link to it).
I looked up at the error message shown when I run my function. And the following is what I see:
ModName: mfc42.dll
ModVer: 6.0.8665.0 Offset: 00004045
Is it anything to do with the mfc42.dll? Running in the debug version doesn't have this problem.
Thanks for any help.
cheers.
-one-
-
April 19th, 2004, 04:52 AM
#8
What is the call stack when the crash occurs? The call stack shows you the series of functions that lead up to the crash.
Also, if you rebuild the release version with debugging information, the crash should occur and you'll be able to use the VC++ debugger to find the problem.
Regards,
Paul McKenzie
-
April 19th, 2004, 08:53 AM
#9
Unhandled exception in test.exe (MFC42.DLL):0xC0000005: Access Violation
This is what I got from the error message. I think the problem is to link the database and edit the database coz my other functions work fine.
Any idea anyone? Thanks for all the help.
Cheers.
-one-
-
April 19th, 2004, 09:57 AM
#10
put a try catch block and put up an message box with the error info.
and Canada rocks!! Peace bro.
-
April 19th, 2004, 10:03 AM
#11
Originally posted by Rivaldo
Unhandled exception in test.exe (MFC42.DLL):0xC0000005: Access Violation
This is what I got from the error message. I think the problem is to link the database and edit the database coz my other functions work fine.
Any idea anyone? Thanks for all the help.
Cheers.
-one-
What about the call stack? When an exception occurs (and if you compiled with debug information turned on), you should get a dialog with an OK and Cancel button, where "Cancel" allows you to debug the application. Did you get this message box? If you did, press Cancel, it will take you to the debugger. Now look at the call stack. What are the functions that led to the call to the MFC42.dll function?
Regards,
Paul McKenzie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|