使用gdb调试程序时提示No symbol table is loaded. Use the "file" command.

这是因为编译.o文件时没有一起生成调试信息,应该在makefile中的编译命令中制定-g参数,如下:

  1 sort:main.o bubble.o

  2     gcc -o sort main.o bubble.o

  3 

  4 main.o:main.c bubble.h

  5     gcc -g -c main.c

  6 

  7 pubble.o:bubble.c

  8     gcc -g -c bubble.c

  9 

 10 clean:

 11     rm sort main.o bubble.o

猜你喜欢

转载自www.cnblogs.com/skxabc/p/9248617.html
今日推荐