Himadri Choudhury
Himadri Choudhury

Reputation: 10353

Visual Studio 2010 doesn't display debug info for local variables

Visual Studio 2010 doesn't display debug info for local variables. I have no problem seeing my class variables though. Is there some setting that I'm missing?

This is a "debug" build.

I tried going to Project Properties -> C++ -> Optimizations and disable all optimizations.

Upvotes: 4

Views: 14261

Answers (7)

Artfunkel
Artfunkel

Reputation: 1852

I was able to fix this problem in VS2015 by enabling Options > Debugging > General > Use Native Compatibility Mode.

MSDN says that "when this option is selected, the debugger uses the Visual Studio 2010 native debugger instead of the new native debugger." We build with Intel C++ 12.1, which is based on VC10, so that makes sense!

Upvotes: 0

Smejki
Smejki

Reputation: 197

If you are experiencing it with within a switch-case statement just add a conditioned empty command like

if(true)
;

for testing purposes. It seems that some older versions of Visual Studio suffered from a bug where a missing conditioning of any kind (while, if...) in one case rendered Locals during debugging in following cases invisible.

Upvotes: 1

YAHOOOOO
YAHOOOOO

Reputation: 957

For those who have any problem regarding this issue...

  1. download the patch from here http://archive.msdn.microsoft.com/KB2452649/Release/ProjectReleases.aspx?ReleaseId=5350
  2. Restart computer
  3. rebuild your project

and most probably everything will be good then....

Upvotes: 1

jaham
jaham

Reputation: 1

Always include just the compatible debug libraries:

I came here because Visual Studio 2010 didn't display debug info for some local variables within the opencv 2.4.2 library. In Mat _InputArray::getMat(int i) const I got to see several variables but k and vv were missing. (and I got an exception in cv::_interlockedExchangeAdd when getMat would (wrongly) return only empty matrices.) Anyway, the problem was: I had included (as library, in the PATH for the dlls and as #pragma comment) both the debug and the release libraries. This seemed to have caused the problem. Everything worked well after included just the debug libraries.

Upvotes: 0

celion
celion

Reputation: 4014

If you're using Visual Studio 2010 Express (like I was) this is fixed by getting Service Pack 1, which you can get by running Windows Update.

Upvotes: 0

helloworld922
helloworld922

Reputation: 10939

check to make sure you're project is setup to export debug symbols. These should be .pdb files. They contain debug information for your code. I believe the setting is under project->Linker->generate debug info.

Upvotes: 2

Related Questions