If you are getting an error similar to the following while compiling a wxWidgets application in debug mode with Visual C++ 6.0, it turns out to be a compiler switch problem. I saw this issue being discussed in a lot of forums but none of their solutions really worked out for me. Well, I had to spend a lot of time to find the solution, I thought I'd share because this one ruined a lot of my time!
Error
Debug Error!
Program: D:\projects\prototypes\wxtest.exe
Module:
File: i386\chkesp.c
Line: 42
The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
(Press Retry to debug the application)
Abort | Retry | Ignore
SolutionIts the exception handling thing! Seems wxWidget compilation needs exception handling enabled. It can be enabled by the /GX switch.
If you dont know how to do it, follow these simple steps:
1.
Project menu >
Settings2. Make sure you have selected the project name in the left tree of the dialog box (It by default is!)
3. Select
C/C++ tab on the right
4. Select
C++ Language in
Category drop down box
5. Check the
Enable exception handling checkbox.
6. Click
OKAlternatively, follow steps 1, 2, 3 and,
4. Insert
/GX switch in the
Project Options text box
5. Click
OKTry recompiling. Error should be gone!