问题描述:
长时间没有用Dev-c++,打开敲了代码之后,点击调试,跳出“项目没有调试信息,您想打开项目调试选项重新生成吗?”。选择“是”之后,再点击调试,竟然直接崩溃闪退了。
问题解决:
win10 Dev-c++ 5.1.1版本
方法一:
1、”工具“ >> “编译选项” >> “代码生成/优化” >> “连接器”;
2、将“产生调试信息”选项选择“Yes”,点击确认。
方法二:
1、在“工具”>> "编译选项” >> "编译时加入以下命令”下面的编辑框里写入:-g3 ;
2、在下面的“在连接器命令行加入以下命令”的编辑框里写入:-g3 ;
3、转到“程序”,把gcc行修改为:gcc.exe -D__DEBUG__ ;
4、把g++行修改为g++.exe -D__DEBUG__ ,点击确定。
重新编译,就能调试了。
其中,参数 -g3
在GCC官方文档第109页这样解释道:
-gvmslevel
Request debugging information and also use level to specify how much information.
The default level is 2.
Level 0 produces no debug information at all. Thus, ‘-g0’ negates ‘-g’.
Level 1 produces minimal information, enough for making backtraces in parts
of the program that you don’t plan to debug. This includes descriptions of
functions and external variables, and line number tables, but no information
about local variables.
Level 3 includes extra information, such as all the macro definitions present in
the program. Some debuggers support macro expansion when you use ‘-g3’.
‘-gdwarf’ does not accept a concatenated debug level, to avoid confusion with
‘-gdwarf-level’. Instead use an additional ‘-glevel’ option to change the
debug level for DWARF.