C++:如何在 Eclipse 中调试使用“Microsoft Visual C++”工具链编译的 C++ 应用程序?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8816923/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 17:32:57  来源:igfitidea点击:

c++: How to debug a C++ application compiled using the "Microsoft Visual C++" toolchain in eclipse?

c++eclipse

提问by mark

I have installed Eclipse CDT and CDT Visual C++ Support (from the Yoxos Marketplace).

我已经安装了 Eclipse CDT 和 CDT Visual C++ Support(来自 Yoxos Marketplace)。

This lets me compiled and run a C++ application, however, I cannot debug it.

这让我可以编译并运行 C++ 应用程序,但是,我无法调试它。

So, I have installed a gdb windows binary using the mingw distribution. Now, when I try to debug, the following message is displayed in the console - No symbol table is loaded. Use the "file" command.

所以,我已经使用 mingw 发行版安装了一个 gdb windows 二进制文件。现在,当我尝试调试时,控制台中会显示以下消息 -未加载符号表。使用“文件”命令。

My uneducated guess is that gdb cannot debug binaries produced by the Visual C++ compiler.

我没有受过教育的猜测是 gdb 无法调试由 Visual C++ 编译器生成的二进制文件。

My question is - how do I debug C++ code in eclipse built using the Visual C++ toolchain?

我的问题是 - 如何在使用 Visual C++ 工具链构建的 Eclipse 中调试 C++ 代码?

My environment:

我的环境:

  • Windows 7 64 bits
  • Eclipse Indigo (the latest version at the moment)
  • Visual Studio 2010, hence Visual C++ ver 10
  • GNU gdb (GDB) 7.3.1
  • I do not know how to get the version of CDT, but I have this jar - org.eclipse.cdt_8.0.0.201109151620.jar, so I guess the version is 8.0
  • 视窗 7 64 位
  • Eclipse Indigo(目前最新版本)
  • Visual Studio 2010,因此是 Visual C++ 版本 10
  • GNU gdb (GDB) 7.3.1
  • 我不知道如何获得CDT的版本,但我有这个jar - org.eclipse.cdt_8.0.0.201109151620.jar,所以我猜版本是8.0

Thanks.

谢谢。

P.S.

聚苯乙烯

Moving to the MinGW g++ compiler is off scope for this question, so please - do not suggest it as the answer.

移动到 MinGW g++ 编译器超出了这个问题的范围,所以请不要建议它作为答案。

采纳答案by Zuljin

As far as I know you can't debug Visual C++ applications using gdb which is only supported by CDT plug-in.

据我所知,您无法使用仅由 CDT 插件支持的 gdb 来调试 Visual C++ 应用程序。

Debugger for Visual C++ toolchain is called CDB and you have to search for the tool that can use it. For sure Visual C++ IDE (even from Express Edition) can be use to debug application that are compiled under Eclipse+CDT. I think that also some nightly builds of CodeBlocks IDE can cooperate with CDB.

Visual C++ 工具链的调试器称为 CDB,您必须搜索可以使用它的工具。可以肯定的是,Visual C++ IDE(甚至来自 Express Edition)可用于调试在 Eclipse+CDT 下编译的应用程序。我认为 CodeBlocks IDE 的一些夜间构建也可以与 CDB 合作。

回答by matteo

Please follow this https://bugs.eclipse.org/bugs/show_bug.cgi?id=162108

请按照这个https://bugs.eclipse.org/bugs/show_bug.cgi?id=162108

Summary: As of the last comment (Doug Schaefer 2012-03-13 10:49:27 EDT) in this bug it seems there are plans to integrate this but it is not yet working.

总结:截至上次评论 (Doug Schaefer 2012-03-13 10:49:27 EDT) 在这个 bug 中,似乎有计划整合它,但它还没有工作。