C++ Visual Studio 没有为此文档加载任何符号
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8341686/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Visual Studio No Symbols have been loaded for this document
提问by Jim Jeffries
I am having some trouble debugging a visual studio 2008 C++ project. When I start running it in debug, the breakpoints are disabled with the message
我在调试 Visual Studio 2008 C++ 项目时遇到了一些麻烦。当我开始在调试中运行它时,断点被禁用并显示消息
The Breakpoint will not be hit. No Symbols have been loaded for this document.
断点不会被击中。尚未为此文档加载任何符号。
I have tried cleaning and rebuilding, but this doesn't make a difference.
我试过清理和重建,但这没有什么区别。
I also tried looking in Debug->Windows->Modules. If I right click on the module I am trying to debug and press Symbol load information it brings up a list of places it has tried to load the symbols from. The first in the list is correct and the file exists, but next to it is this error
我还尝试查看调试-> Windows-> 模块。如果我右键单击要调试的模块并按符号加载信息,它会显示它尝试从中加载符号的位置列表。列表中的第一个是正确的,文件存在,但旁边是这个错误
C:\path\to\my\symbol\Debug\MyProject.pdb: Unknown symbol handler for error
C:\path\to\my\symbol\Debug\MyProject.pdb:错误的未知符号处理程序
Does anyone know what causes this or how to fix it?
有谁知道是什么原因导致这个或如何解决它?
采纳答案by TurnsCoffeeIntoScripts
First of all, it is possible that some of your modules won't show in the module window, because some of them may be loaded dynamically (only as needed).
首先,您的某些模块可能不会显示在模块窗口中,因为其中一些模块可能会动态加载(仅在需要时)。
You might want to check in your project properties under Linker > Debugging > Generate Program Database File and Generate Debug Info. Be sure these two are set properly.
您可能希望在 Linker > Debugging > Generate Program Database File 和 Generate Debug Info 下检入您的项目属性。确保这两个设置正确。
Also, check if C/C++ > General > Debug Information Format is set to Program Database for Edit And Continue (/ZI) or something similar.
另外,检查 C/C++ > General > Debug Information Format 是否设置为 Program Database for Edit And Continue (/ZI) 或类似内容。
I know you mentioned that your symbol file exists, but checking was I just mentioned will make sure you have the right version of your symbol in the right place.
我知道你提到你的符号文件存在,但检查我刚刚提到的将确保你在正确的位置拥有正确版本的符号。
Finally, check if all your project and files in your solution are set to compile as Debug and not Release or something else, because no symbols will be generated (hence none will be loaded) for this project / file.
最后,检查您的解决方案中的所有项目和文件是否都设置为编译为 Debug 而不是 Release 或其他内容,因为不会为此项目/文件生成符号(因此不会加载任何符号)。
Hope this helps a bit.
希望这个对你有帮助。
回答by Razvan Socol
In my case, the problem was solved by checking "Use Managed Compatibility Mode" in Tools / Options / Debugging / General.
就我而言,问题是通过在工具/选项/调试/常规中选中“使用托管兼容模式”来解决的。
回答by James Jenkinson
In case anyone has this problem when using 'Attach to process', the answer to this question solved it for me:
如果有人在使用“附加到处理”时遇到这个问题,这个问题的答案为我解决了这个问题:
Visual Studio is not loading modules when attaching to process
Specifically, switching to 'Native code' in the 'Attach to' options instead of 'Auto'.
具体来说,在“附加到”选项中切换到“本机代码”而不是“自动”。
回答by Jim Jeffries
I have managed to solve this by copying my source sideways and checking out a completely clean copy. I assume it was some setting stored in the projects .suo file.
我设法通过横向复制我的源代码并签出一个完全干净的副本来解决这个问题。我认为这是存储在项目 .suo 文件中的一些设置。
回答by David
There could be a problem with the mspdbsrv.exe process. Try killing it and start debugger again.
mspdbsrv.exe 进程可能存在问题。尝试杀死它并再次启动调试器。
回答by Volodymyr Frytskyy
For me the fix was in restarting the Visual Studio:) As simple as that. Nothing else helped - tried to Clean (even deleted all files in the Debug folder), checked settings, even killed the mspdbsrv.exe process, but only VS restart did the trick.
对我来说,修复是重新启动 Visual Studio:) 就这么简单。没有其他帮助 - 尝试清理(甚至删除 Debug 文件夹中的所有文件),检查设置,甚至杀死 mspdbsrv.exe 进程,但只有 VS 重新启动才能解决问题。
回答by Peyton Stults
Delete all files in the bin and obj folders. Then build the solution again. If your problem was like mine, it seemed like VS was loading an older version of a specific unknown file that rebuilding the solution/project would not replace. Make sure to make a copy of your solution/project before trying this. Good Luck!
删除 bin 和 obj 文件夹中的所有文件。然后再次构建解决方案。如果您的问题和我的一样,那么 VS 似乎正在加载特定未知文件的旧版本,重建解决方案/项目不会替换该文件。在尝试之前,请确保复制您的解决方案/项目。祝你好运!
回答by Vijay Bansal
回答by Diego
Make a copy of your "Debug" folder within your project's folder, then delete every file in the original "Debug" folder. As additional measure if you had your visual studio already running with your project loaded, close it after deleting Debug's contain and reopen it before re-build the whole project, theoretically this action will create new copy of symbol files and the rest needed to debug your code. I found out this problem occurred to me when I moved my files to other computer and try to compile and debug my code from there, although all folder and drive names were the same, some how the IDE was unable to use the previously created symbol files. Hope this work around works for some one else !.
在项目文件夹中复制“Debug”文件夹,然后删除原始“Debug”文件夹中的每个文件。作为额外的措施,如果您的 Visual Studio 已经在加载项目的情况下运行,请在删除 Debug 的包含后关闭它并在重新构建整个项目之前重新打开它,理论上此操作将创建符号文件的新副本以及调试所需的其余部分代码。当我将文件移动到其他计算机并尝试从那里编译和调试我的代码时,我发现这个问题发生在我身上,尽管所有文件夹和驱动器名称都相同,但有些 IDE 无法使用以前创建的符号文件. 希望这项工作对其他人有用!
回答by Alan M
VS2015 C++
VS2015 C++
I ran into the same problem after cancelling the loading of symbols whilst attempting to debug my application in VS2015. After this, VS2015 refused to load the symbols for the project I was interested in (multiple sub projects in a solution with C# calling C++ DLLs). Solutions above did not work for me, but this did.
在尝试在 VS2015 中调试我的应用程序时取消符号加载后,我遇到了同样的问题。在此之后,VS2015 拒绝加载我感兴趣的项目的符号(使用 C# 调用 C++ DLL 的解决方案中的多个子项目)。上面的解决方案对我不起作用,但确实如此。
For Visual Studio 2015 (C++):
对于 Visual Studio 2015 (C++):
- Right click on your project that your break point is in and select
properties Expand C/C++ - Select General under C/C++
- Change the Debug Information Format to any other option
- Click Apply
- Change the Debug Information Format back to its default "Program Database for Edit And Continue (/ZI) (or whatever you prefer)
- Click Apply
- Now rebuild your project
- 右键单击断点所在的项目,然后选择
属性展开 C/C++ - 在 C/C++ 下选择 General
- 将调试信息格式更改为任何其他选项
- 点击应用
- 将调试信息格式更改回其默认的“用于编辑并继续的程序数据库 (/ZI)(或您喜欢的任何内容)”
- 点击应用
- 现在重建你的项目
Hope this helps. Alan M
希望这可以帮助。艾伦