Gcc -g Option Flag (debug)

RapidTables Search Share Home›Code›Linux›GCC› gcc -g gcc -g option flag

gcc -g generates debug information to be used by GDB debugger.

option description
-g0 no debug information
-g1 minimal debug information
-g default debug information
-g3 maximal debug information

Syntax

$ gcc -glevel [options] [source files] [object files] [-o output file]

Example

Write source file myfile.c:

// myfile.c #include <stdio.h> void main() { printf("Program run!!\n"); }

Build myfile.c on terminal and run gdb to debug:

$ gcc -g myfile.c -o myfile $ gdb myfile (gdb) run Starting program: /home/ubuntu/myfile Program run!! Program exited with code 012. (gdb) quit $

See also

  • gcc
  • gcc -c
  • gcc -D
  • gcc -I
  • gcc -L -l
  • gcc -o
  • gcc -O
  • gcc -Wall

Write how to improve this page

Submit Feedback
GCC
  • gcc -c
  • gcc -D
  • gcc -fPIC
  • gcc -g
  • gcc -I
  • gcc -L -l
  • gcc -o
  • gcc -O
  • gcc -Wall
RAPID TABLES
  • Recommend Site
  • Send Feedback
  • About
Home | Web | Math | Electricity | Calculators | Converters | Tools

© RapidTables.com | About | Terms of Use | Privacy Policy | Cookie Settings

Từ khóa » G Gcc