Source: https://www.youtube.com/watch?v=svG6OPyKsrw

ToC

Compile for GDB

g++ -g -std=c++14 [filename].c -o [output] According to https://bytes.usc.edu/cs104/wiki/gcc/

  • -g provides debugging feature for your program. You will need this when you want to use gdb or valgrind.
  • --std=c++<##> uses version <##> of C++ when compiling. This will allow you to use specific features of that C++ version. Typically, we have you use --std=c++17.
  • -o <filename> compiles and links files into an executable named <filename>. The default filename is a.out.
  • And etc
  • *Bonus: https://stackoverflow.com/questions/5179202/gcc-g-what-will-happen