GNU Compiler Collection (GCC) is an optimizing compiler produced by the GNU Project supporting various programming languages, hardware architectures and operating systems. It includes front ends for C, C++, Objective-C, Fortran, Ada and Go.

This article discuss about commonly encountered GCC compiler flags.

  • Disable the unused variable warnings
    Use flag -Wno-unused-variable to disable warning as error such as
    C:\boost_1_52_0/boost/system/error_code.hpp:214:36: error: 'boost::system::posix_category' defined but not used [-Werror=unused-variable]
  • Enable all warning messages
  • Enables some extra warning flags that are not enabled by -Wall
  • Treat warning as error
  • Warn if the compiler detects paths that trigger erroneous or undefined behavior due to dereferencing a null pointer