在C ++中调试包含文件 [英] Debugging include files in C++

查看:94
本文介绍了在C ++中调试包含文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我遇到以下问题:
我在项目中包含了其他文件夹中的一些源文件(位于项目属性"-> VC ++目录->包含"->我的外部文件夹"中),并且代码从这些源文件中崩溃了.我的问题是:如何进入这些源文件?

预先感谢,
Tamash

解决方案

在编辑器的外部文件夹中打开源文件-该文件将显示在解决方案资源管理器的文件列表中.然后,像其他任何源文件一样,在所需的行上放置一个断点. 这告诉Visual Studio如何将二进制文件(.lib,.dll等)与源代码相关联.它还包含代码的完全限定路径(例如C:\Libraries\My Project\Lib.cpp).

如果Visual Studio可以找到此文件,则它将自动加载该文件并显示调试信息.可以在工具">选项">调试">符号"中进行设置(在VS2008中,其他版本可能有所不同).

汉斯的答案也需要这样做,尽管如果您打开源文件,Visual Studio会自动在附近的一些目录中搜索.pdb文件,而不是手动设置它们.


Hello everybody,

I come across the following problem :
I have included some source files from a different folder in my project ( at Project Properties-> VC++ directories -> Include -> My external folder ) and my code crashes in a function from those source files. My question is : how can I Step Into those source files?

Thanks in advance,
Tamash

解决方案

Open the source file in the external folder in the editor - it will appear in the list of files in the Solution Explorer. Then put a breakpoint at the line you want, just like any other source file.


When the external project is compiled, there will be Debug DataBase files generated (.pdb)
This tells Visual Studio how to relate the binary files (.lib, .dll, ...) with the source code. It also contains the fully qualified path to the code(such as C:\Libraries\My Project\Lib.cpp).

If visual studio can find this file then it will automatically load it and show debugging info. This can be set from Tools>Options>Debugging>Symbols (in VS2008, other versions may be different).

This is also required for Hans'' answer to work too, although if you open the source file Visual studio will automatically search some nearby directories for the .pdb files, rather than manually setting them.


这篇关于在C ++中调试包含文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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