C语言 在 Dev-C++ 中调试使 IDE 崩溃且无响应
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32685287/
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
Debugging in Dev-C++ makes IDE crash and not respond
提问by qwerty_
I'd love to ask someone to hint me what to do. I have installed Dev-C++ on my computer (the 5.11 ver.) I don't know what happened to it, if it's Windows 8.1 problem or some other I really don't know, but when I start to debug, it simply stops working. What exactly happens: I open dev-c++, then I open my *.c file. I set a breakpoint in my source code, and when I hit debug, a pop-up windows shows:
我很想请人提示我该怎么做。我已经在我的电脑上安装了 Dev-C++(5.11 版)我不知道它发生了什么,如果是 Windows 8.1 问题还是其他一些我真的不知道,但是当我开始调试时,它只是停止在职的。究竟发生了什么:我打开 dev-c++,然后打开我的 *.c 文件。我在我的源代码中设置了一个断点,当我点击调试时,一个弹出窗口显示:
You have not enabled debugging info (-g) and/or stripped it from executable (-s) in Compiler Options.
Do you want to correct this now?
And when I hit yes, it simply stops to respond, and crashes. I have never occured such situation, because on every computer I have worked, I'd got no problem with debugging on Dev-C++. Even running it in compatibility mode didn't help. I really don't know what to do. For any help, thanks in advance!
当我点击是时,它只是停止响应,然后崩溃。我从未发生过这种情况,因为在我工作过的每台计算机上,我在 Dev-C++ 上调试都没有问题。即使在兼容模式下运行它也无济于事。我真的不知道该怎么办。对于任何帮助,提前致谢!
回答by Piseth Sok
回答by aysebilgegunduz
- Open File -> New -> Project -> Console Application or Empty project
- Write a project_name and select OKbutton

- write your code and Save as main.c in the same folder you saved you .dev file

- add watcher any line you want and debug it.
- 打开文件 -> 新建 -> 项目 -> 控制台应用程序或空项目
- 写一个 project_name 并选择OK按钮

- 在保存 .dev 文件的同一文件夹中编写代码并另存为 main.c

- 添加观察者你想要的任何行并调试它。
Thats all. You don't need to add any parameter to anywhere.
就这样。您无需在任何地方添加任何参数。
回答by vikas bhukar
- GO to Tools > Compiler Option >
- On select Compiler Set to Configure >> TDM-GCC 4.9.2 64 bit Debug
- Now in general tap space put -g
- Most Important: Rebuild All (F12) **
- 转到工具 > 编译器选项 >
- 在选择 Compiler Set to Configure >> TDM-GCC 4.9.2 64 bit Debug
- 现在一般点击空间放 -g
- 最重要:全部重建 (F12) **
回答by Henrique
adding the -g manually did not work for me.
手动添加 -g 对我不起作用。
This is what worked for me :
这对我有用:
As other said, you have to create a new PROJECT, then paste your old code into it. after that, just press the debugger button as you would, it will ask to put the -g for you, and this time when you say YES, it will not crash. It will work as a charm.
正如其他人所说,您必须创建一个新的PROJECT,然后将旧代码粘贴到其中。之后,只需按调试器按钮,它会要求为您放置 -g,这一次当您说 YES 时,它不会崩溃。它将成为一种魅力。
Watch this video to clarify : https://www.youtube.com/watch?v=xFpShi0yAc4
观看此视频以澄清:https: //www.youtube.com/watch?v=xFpShi0yAc4
回答by Dipak Bari
I also got the same problem when I ran my Program without compiling. That was only the reason for this crashes and errors for me.
当我在没有编译的情况下运行我的程序时,我也遇到了同样的问题。这只是我崩溃和错误的原因。
Dev-C++ IDE requires compilation first then after it allows to run the program unlike other IDE like C-Free which automatically compiles first and run the program for you.
Dev-C++ IDE 需要先编译,然后才能运行程序,这与 C-Free 等其他 IDE 不同,C-Free 会先自动编译并为您运行程序。
Use F11shortcut key for compile and run the program for Dev-C++ IDE.
使用F11快捷键编译并运行 Dev-C++ IDE 的程序。
It works for me.
这个对我有用。
回答by WollyMc
Follow these steps:
按着这些次序:
a) Tools -> Compiler Options.
a) 工具 -> 编译器选项。
b) Put -gin both boxes of the compiler tab.
b) 放入-g编译器选项卡的两个框中。
c) Make sure both the boxes with "Add the following...." are checked and then hit ok.
c) 确保选中带有“添加以下内容....”的两个框,然后点击确定。
回答by Tsung
You have to first set up your compiler property by adding -g to both commands fields. Here is a YouTube video shows you how to do that.
您必须首先通过将 -g 添加到两个命令字段来设置编译器属性。这是一个 YouTube 视频,向您展示了如何做到这一点。
https://www.youtube.com/watch?v=EOnl-Ojd66Q
https://www.youtube.com/watch?v=EOnl-Ojd66Q
I'm also using window 8, and after following the video, I still got the same pop up widow with the same message. I found out if you click no for "Do you want to correct this now" the debugger will start working. I don't know why, but it works for me. Good luck!
我也在使用窗口 8,在观看视频后,我仍然收到相同消息的相同弹出窗口。我发现如果您单击“是否要立即更正此问题”的“否”,调试器将开始工作。我不知道为什么,但它对我有用。祝你好运!
回答by Ankit Joshi
Go to Tools => Compiler options.
Then select TDM-GCC 4.9.2 64-BIT DEBUG
Worked for me.
转到工具 => 编译器选项。
然后选择 TDM-GCC 4.9.2 64-BIT DEBUG
对我来说有效。
回答by user6951467
first you have to create a project; then copy your code into the project; set the following compiler option: settings tab -> code generation : disable all optimizations and finally settings tab -> linker: set to yes the generating debugging information and the strip executable choices. good luck
首先你必须创建一个项目;然后将您的代码复制到项目中;设置以下编译器选项:设置选项卡 -> 代码生成:禁用所有优化,最后设置选项卡 -> 链接器:将生成调试信息和条带可执行选项设置为是。祝你好运

