How Can I debug a C program on Linux?

Compile your code with the -g flag, and then use the gdb debugger. Documentation for gdb is here, but in essence:

gcc -g -o prog myfile.c another.c

and then:

gdb prog

If you want a user-friendly GUI for gdb, take a look at DDD or Insight.

Leave a Comment