Value for a structure is not showing in watch window in VS2008
-
We have a console application in VS2008 in which we have defined a global variable for a structure. The members of the variable are used throughout the application in various functions. Recently we have taken some of the functions out of the application to create a separate library and have included the library and the header file in the console application. Now When I build the application and run it, the output and behavior of the whole application is correct and same as before. But when i try to set breakpoints and debug some of the functions in the console application to watch the values in the watch window, the structure variable shows empty in the value column. The global variable for the structure is also used in the library. Please suggest a solution to view the values in the watch window
-
We have a console application in VS2008 in which we have defined a global variable for a structure. The members of the variable are used throughout the application in various functions. Recently we have taken some of the functions out of the application to create a separate library and have included the library and the header file in the console application. Now When I build the application and run it, the output and behavior of the whole application is correct and same as before. But when i try to set breakpoints and debug some of the functions in the console application to watch the values in the watch window, the structure variable shows empty in the value column. The global variable for the structure is also used in the library. Please suggest a solution to view the values in the watch window
-
Check the project settings and ensure that both the application and library are built in Debug mode.
Problem solved. One of the lib was in release mode. got it fixed. Thanks
-
Problem solved. One of the lib was in release mode. got it fixed. Thanks
That should work and does on VS2015 and VS2107 so if it doesn't work on VS2008 it's a very old bug. You can however easily hack around it, just make a local variable struct and copy the global struct to the local ... the watch window can't get that wrong and it's one single line of code :-) Other alternative is to try the later compilers, they are free and easy to download and try.
In vino veritas