Nothing more to add, though could be more careful during debugging.
Usually, in a large application involving many modules & files, which is usually production and release build, while debugging, we only set /Od for the files we think will showcase the error and the local variables.
In that case only, I have found that the variables in the files that missed /Zi (debug symbols) do not get shown. This can be also (but not exclusively) due to that in Visual Studio project, you have /Zi , /Z7 etc or /Od set in project-level, while the file-level settings may over-ride the project settings.
Apart from this, there are situations Ithink, which you may try, when the linker options need to set the /debug or /pdb set of options in the project, so as to ensure they are seen in Watch or correct symbol information is generated.
The errorCXX0017 error is a Visual C++ project error usually, and you may need to check the following which I came across:--
A symbol specified in an expression could not be found.
One possible cause of this error is a case mismatch in the symbol name. Because C and C++ are case-sensitive languages, a symbol name must be given in the exact case in which it is defined in the source.
This error can occur when trying to typecast a variable in order to watch the variable during debugging. The typedef declares a new name for a type, but it does not define a new type. The typecast attempted in the debugger requires the name of a defined type.
Make sure the symbol is already declared at the point in the program where it is being used.
Use an actual type name to cast variables in the debugger, rather than a typedef-defined name.
There may be more than 1 factor you may need to look into, as the simple test application at your end is not failing to debug with local variables, so it seems to be project-setting related problems as stated above, or mismatches in symbol name .
On the Debug menu, choose Windows, then choose the name of the variable window you want to display (Autos, Locals, Watch, or Watch1 through Watch4).
I believe the reason you are not able to locate the menu option is :-- You cannot access these menu items or display these windows in design mode. To display these menu items, the debugger must be running or in break mode.
Please try it and check for Locals & Auto windows too..
Also, if possible and feasible for you, try using Windbg , windows debugger for debugging in that part of application, it offers more extensive set of debugging options, the command-line options (like dt , dv for display type, display variable etc if you search in Windbg tutorial) , unlike Visual Studio debugger which only provides Windows to look at variables etc. So, might be, the command-line commands (display variable, dv) in Windbg may give you headroom for watching variables, plus you can watch the,m in Locals or Watch window as in Visual Studio .
I am having the same problem with Intel Parallel Studio 2011 in Visual Studio 2010. Once the debugger steps into a while or for loop I can no longer watch any values (which will also cause break conditions not to work). It happens with every single C++ project I create in which I use Intel C++ as compiler. If I recall correctly, it also occurred with the previous version of IPS in Visual Studio 2005.
Another issue I get is that STL containers storing objects show "error" instead of their value in many cases. The number of items is correctly displayed, though. That means that if an STL container (like vector or deque) has 10 items, I will see "error" 10 times.structs and built-in types seem to work just fine. I have no idea if both problems are somehow related.
Those are indeed quite serious issues which heavily hurt development. My current workaround is to debug in disassemble mode, and it is not nice. For the STL problem the only workaround would be to know the internal structure of the container, and it is not nice either.
Have you made any progress on the issue?
Thanks to binksoftware for submitting a testcase that duplicates the debug issue. I'll file a bug report to the compiler.
Please stay tuned and I'll let you know when it's fixed.
Thanks all for yourpatience!