gpt4 book ai didi

c - 使用 Code::Blocks 调试 C

转载 作者:太空宇宙 更新时间:2023-11-04 03:28:40 26 4
gpt4 key购买 nike

我将我的代码作为一个独立的 .c 文件并阅读,为了调试,该文件必须在一个项目中。所以我创建了一个空项目并将我的文件添加到其中,设置了一些断点,当我运行调试器时,我在控制台上得到了这个:

Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.6.1
Child process PID: 13112
Error in re-setting breakpoint 2: PC register is not available
Error in re-setting breakpoint -3: PC register is not available
In ()

尝试了一些教程并观看了一些视频但没有成功。有人知道解决办法吗?有没有更简单的方法来调试 .c 文件?

最佳答案

对于 linux 系统,您可以通过这种方式使用 gdb 作为调试器:

$ vim hello.c
# include <stdio.h>

int main()
{
printf("hello \n");
}

$ gcc -o hello hello.c

$ ./hello
$ gdb hello
(gdb) break main
(gdb) run

然后你可以使用: c 或继续 n 或下一个 s或步骤有关详细信息,请参阅 this .

关于c - 使用 Code::Blocks 调试 C,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39186109/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com