|
Windows XP Pro, Visual Studio 2008, C++, MFC
Start an application in the debugger and step over:
unsigned int length = 0;
length = strlen( some_char_array );
When hovering over the variable the debugger will not show a value for length. It does show the text of some_char_array, passed in as an argument. Quick watch claims that length is not defined. A breakpoint was set in the constructor of that object and it is being called. The same problem exists there also.
In the below fragment neither the if or the else is executed:
if( length < SOME_CONSTANT )
{ X = 1; }
else
{ X = 2; }
What have I done that will cause the debugger to not show variables?
EDIT: To be more precise the quickwatch says:
CXX0030 Error: expression cannot be evaluated.
Thanks for your time
modified 13-Feb-13 9:44am.
|
|
|
|
|
It is possible that the executable you are debugging is not up to date with the source code. Try a full rebuild of your project.
|
|
|
|
|
The computer was rebooted, same results. On the above suggestion, did a Clean and Rebuild, same results. I will try another reboot and clean and if sucessful, will post the results. Otherwise, assume no change.
(The working computer has no internet connection and is in another room)
I also noticed:
m_hour = 0;
m_minute = 0;
m_second = 0;
All are declared a member variables. The debugger skipped over m_hour and visited m_minute and m_second. Very curious.
EDIT
After a reboot and after deleting the *ncp and *.pch files, the results were the same. Another Clean and Build had no effect.
THEN
I realized the project was set to build the realease version. (That is displayed in the toolbar) After changing that to debug, everything seems normal again. I could whine about this, that, and the other, and how it SHOULD work but that is not going to change anything. The end result is almost two hours expended learning this little lesson because I did not notice all the indicators.
Thanks for taking the time to post.
Thanks for your time
modified 13-Feb-13 10:10am.
|
|
|
|
|
Yeah, release version isn't built with debug information so the debugger doesn't work right.... You can however, mix debug and release versions of things to debug the portions that are built with debug information hence Visual Studio allowing you to do this... So, it's really working as it should be.
|
|
|
|
|
bkelly13 wrote: I realized the project was set to build the realease version. Yeah, we've all done that once or twice. The thing with the Release build is that variables can get optimized away that will always show up in the Debug build. BTW I don't think that rebooting would have made any difference to the situation.
|
|
|
|