开发者

How to repair Visual Studio locals/watches in C++ (Debug build)

开发者 https://www.devze.com 2023-03-26 04:45 出处:网络
Sometimes VS autos/locals/watches break and instead of variables/values all I have is different kinds of:

Sometimes VS autos/locals/watches break and instead of variables/values all I have is different kinds of:

CXX0029: Error: not struct pointer  
CXX0033: Error: error in OMF type information   
CXX0072: Error: type information missing or unknown 
CXX0025: Error: operator needs class/struct/union   

Rebuilding project, cleaning PDB/NCB e开发者_如何学编程tc doesn't solve it. What can I do?


Look at this Microsoft support note on: FIX: CXX0033 Error in OMF Type from Forward Class Declaration

Once you fix the PCH problem cited in the support note, I think all your errors will go away.


There is in fact a solution that lets you keep using precompiled headers: check out this more recent KB article and the documentation of the /Yl switch - which seems specifically tailored to this error.

Just add to the stdafx.cpp (or your own custom /Yc file) command line '/Ylxxxx', where xxxx stands for an arbitrary function name in your lib.

I recently faced symptoms identical to yours (in VS2010), and that solved it for me.


Are you trying to debug the "release" build? If so, many local variables will not exist as "debuggable" elements. You can get around this (if you must debug the release build) by debugging at the assembly level and look at the register values (vs. stack values, where auto/local would be in the debug build) and cast them appropriately in the "watch window".

Otherwise, build the Debug build and debug that build version. You'll get assertions where preconditions are not met, relevant/irrelevant stuff dumped to your output window, and more straight-forward debug single stepping.


It helped me to switch from using a program database (/ZI) to "c7 compatible" (/Z7). Switching off precompiled headers did not make a difference. Neither did rebuilding.

0

精彩评论

暂无评论...
验证码 换一张
取 消