dev C++ 不能调试的解决方法

来源:互联网 发布:android放弃java 编辑:程序博客网 时间:2024/04/30 14:20

http://blog.csdn.net/Hou_Rj/article/details/4776172


DevC++4.9.9.2中,按 F8 开始调试。提示信息为:工程没有调试信息,您想打开工程的调试选项并重新生成吗?选择是后,再按F8,仍旧是这个信息。什么原因呢?

按照帮助,Frequently Asked Questions (FAQ)中提示
How do i enable Debugging mode ?

Go to Compiler Options and click on the Compiler sheet. In the Linker section, put projectes?to 'Generate debugging information'. Do a 'Rebuild All' and you should be able to debug now.
tools->compiler option->settings->linker里设置为yes后,Generate debugging information,并且Rebuild All 了。还是不行,但是,经试验发现,系统提供的例子程序却能调试,没办法,只好比较一下编译信息,发现,自己建立的工程在编译的时候,没有加-g选项,在 gdb的帮助里说到,要想使用gdb调试,必须加上这个参数(因为Dev C++使用的是gdb调试器),在仔细查找,发现在工程文件夹里有一个Makefile.win的文件,打开一个,是一个Makefile文件,因此,就 得从刚才compiler option选项里配置,经过试验,有四处需要变化:

1、在“工具”-》编译选项-》"Add following commands when calling complier"下面的编辑框里加上:-g3
2、在下面的"Add these commands to the linker command line" 下的编辑框上加上:-g3

3、转到programs页,把gcc行修改为:gcc.exe -D__DEBUG__

4、把g++行修改为g++.exe -D__DEBUG__ ,点击ok。
重新编译,就能调试了。

在笔者的机器上试验成功,大家可以参照此方法,去配置你的Dev ++环境。

原创粉丝点击