当我将鼠标指针移动到VS2010中的变量上时,无法看到调试值 [英] Not able to see debug values when i move mouse pointer over the variable in VS2010

查看:824
本文介绍了当我将鼠标指针移动到VS2010中的变量上时,无法看到调试值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在使用针对c ++的vs2010编译器进行项目构建。问题是,当我调试创建的应用程序时,我需要动态地查看值,所以我放了几个断点并开始调试。但是当我将鼠标移到变量上时,值不会显示出来。当我使用cout打印值时,值打印没有问题。当我尝试为变量添加监视时,监视窗口将变量显示为未定义或某些东西..,



如果有人知道需要更改什么设置或者我做错了什么,请说。让我知道你的想法!



谢谢,

Sajith

Hi,

I am having a project build using vs2010 compiler for c++. The problem is, when i debug the application created, i need to see the values dynamically, so i put few break points and started debugging., but the values are not getting shown up when i move the mouse over the variables. When i print values using cout, the values gets printed without problem., and when i tried to add watch for the variable, the watch windows shows the variable as undefined or some thing..,

Kindly if some one knows what setting needs to be changed or if i am doing some thing wrong. Let me know your thoughts!

Thanks,
Sajith

推荐答案

一些可能出错的事情:



1.您确定您查看的文件是您编译的文件吗?也许您正在查看意外打开的副本而不是当前的源文件。您可以通过将鼠标悬停在标签标题上来查看文件的位置。



2.您是否通过#ifdef命令排除部分代码来使用条件编译?也许您尝试查看的符号从编译中排除。



3.是您想要在活动范围内查看的变量,i。即在与计划柜台当前位置相同的范围内?也许断点只有在变量超出范围后才会命中。在这种情况下,变量被认为是一个未定义的符号,就像你说监视窗口所说的那样。



如果不是这些,也许你应该发布你的部分显示断点位置和要查看的变量的代码。



PS:我刚刚回忆起选项3的一个棘手的变种:如果你在一个变量中定义一个变量for循环的标题,然后它将在循环结束时超出范围!所以,如果你试试这个:

A few things that could go wrong:

1. Are you sure the file that you look at is the one you compiled? Maybe you are looking at a copy that you accidentally opened instead of the current source file. You can view the location of the file by hovering the mouse over the tab title.

2. Have you used conditional compilation by excluding parts of your code through #ifdef commands? Maybe the symbols you try to view are excluded from compilation.

3. are the variables you want to view within the active scope, i. e. within the same scope as the current position of the program counter? Maybe the breakpoint hits only after the variable has run out of scope. In that case the variable is considered an undefined symbol, just like you said the watch window states.

If it's none of these, maybe you should post the section of your code showing the position of the breakpoint and the variable you want to view.

P.S.: I just recalled a tricky variant to option 3: if you define a variable within the header of a for loop, then it will go out of scope at the end of the loop! So, if you try this:
for int i = 0; i < 10; ++i)
   if (myvec[i] < 0)
      break;

* // break somewhere here



在此循环之后,您无法查看 i 的值,因为它不再存在!这很棘手,因为VS的早期版本确实保留了这些变量,甚至更加困扰循环(违反C ++标准的规则)


You can not view the value of i after this loop, because it no longer exists! It's tricky because earlier versions of VS did retain such variables even affter the loop (against the rules of the C++ standard)


感谢您的时间。最近我注意到同样的问题再次发生为了我!也就是说,当我将鼠标放在变量上时,我无法在调试时看到变量的值。我多次编译我的解决方案以摆脱这个问题,但它没有帮助。我继续删除exe文件并再次编译我的解决方案。它只是做了一个链接并创建了exe但问题仍然存在。所以我想确保变量存在的文件被正确编译。所以我删除了一个;检查在编译解决方案时是否抛出任何编译错误。但是在编译解决方案时,我注意到编译成功了,并没有找到我输入的错误。所以现在我决定单独编译变量存在的文件,这次编译器发现它编译文件的错误,现在我再次编译解决方案。这次我调试时我能看到变量值调试时...





结论:在我的情况下,问题是,当我编译解决方案时,文件没有正确编译多次进行更改。
Thanks for your time guys., Recently i noticed the same issue occurred again for me! that is, when i keep my mouse over the variable, i was not able to see the value of the variable while debugging. i compiled my solution mutiple times to get rid of this problem, but it did not help. I went on to delete the exe file and again compiled my solution., it just did a linkage and created the exe but the problem still existed. So i wanted to make sure that , the file in which the variable exist was properly compiled., so i removed a ";" to check if it throws any compilation error when compiling the solution. But on compiling the solution, i noticed that the compilation was successful and it did not find the error that i put in . So now i decided to compile the file alone in which the variable exist , this time the compiler found the error that is it compiled the file, now again i compiled the solution., this time when i debug i was able to see the variable value while debugging...


Conclusion : In my case, the problem was, the file was not compiling properly when i compile the solution making changes multiple times.


您好,



我发现了破解本机代码并可以访问STL的方法使用CLI调试时容器的内容:



Tools \Options ... \Debugging\General:取消选中'使用托管兼容模式'(是!UNCHECK IT !)



在本机代码中,只需添加断点,只需添加:



断言( false);



打破海岸时,只需点击重试进行调试或忽略即可继续。



使用Visual Studio 2015进行快乐调试:)



Kochise
Hello,

I've discovered the way to break into native code and have access to STL containers' content when debugging using CLI :

Tools\Options...\Debugging\General : uncheck 'Use Managed Compatibility Mode' (YES! UNCHECK IT!)

In the native code, instead to add breakpoints, just add this :

assert(false);

When breaking against the shores, just click either 'Retry' to debug or 'Ignore' to continue.

Happy debugging with Visual Studio 2015 :)

Kochise


这篇关于当我将鼠标指针移动到VS2010中的变量上时,无法看到调试值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆