GCC cheatsheet

less than 1 minute read

Updated:

Something that I need for GCC

gcc

#include <stdio.h>
// main.c

int main(void)
{
	printf("Hello World!\n");
}
  • Normal Compile & execute
    gcc main.c 
    
    ./a.out
    Hello World!
    
  • Naming Option
    gcc -o main main.c
    
    ./main
    Hello World!
    
  • redirection
    ./a.out < input.txt
    
  • gdb compile
    gcc -g -o main main.c
    
    gdb ./main
    

Leave a comment