Re: MFC Application has encountered a problem and needs to close. HELP




"Alan Williams-Key" <AlanWilliamsKey@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:E04D7A53-A26D-4960-A488-C375E47BF109@xxxxxxxxxxxxxxxx

Whenever I run the program in debug configuration it runs OK.

I have two main questions:
1 How can the program behave so differently in the two configurations? I can
find no explanation of this in the help files.

a) If there is significant code inside a portion which exists only in the _DEBUG compilation. Not just inside a chunk with #ifdef _DEBUG explict, but also implicitly inside ASSERT and TRACE and so on.

b) The debug version initialises uninitialised variables. So an uninitialised variable can have different initial values in the debug and release versions. It is definitely worth getting used never to writing

int *p;

but always

int *p = .....

including if necessary
int *p = NULL;

And before you do anything else, try "clean solution" in the project both on the debug and release versions, delete the .ncb .ilk and .aps files for good measure, and rebuild both. It's amazing how often that makes problems go away!

Dave
--
David Webber
Author of 'Mozart the Music Processor'
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mozartists/mailinglist.htm

.



Relevant Pages