C++ Visual Studio 无法调试,只能附加

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

Visual Studio can't debug, can only attach

c++cvisual-studiovisual-c++

提问by user3179229

I cannot press F5to debug my program, because there is only an Attach...button instead of a Debugbutton.

我不能按F5来调试我的程序,因为只有一个Attach...按钮而不是一个Debug按钮。

I am using a .c source file, and I was able to debug my sources until I changed a .cpp to a .c and now every source file I open, it says "Attach...". What do I do?

我使用的是 .c 源文件,并且我能够调试我的源,直到我将 .cpp 更改为 .c 并且现在我打开的每个源文件都显示“附加...”。我该怎么办?

回答by user3140854

Try menu ToolsCustomizeCommandsAdd command...[button]Debug(under Categories). Find and add the button you would like to.

尝试菜单工具自定义命令添加命令...[按钮]调试(在Categories下)。找到并添加您想要的按钮。

Also try setting your project to startup one - in Solution Explorer - right click on the project and choose the Set as Startupproject option.

还可以尝试将您的项目设置为启动项目- 在解决方案资源管理器中 - 右键单击​​该项目并选择“设置为启动项目”选项。