gcc Warnings


Syntax

  • gcc [-Woption [-Woption [...]]] src-file

Parameters

ParameterDetails
optionIt can be used to enable or disable warnings. It can make warnings into errors.
src-fileThe source file to be compiled.

Remarks

It is a good practice to enable most warnings while developing a software.

Enable nearly all warnings

C source file

gcc -Wall -Wextra -o main main.c

C++ source file

g++ -Wall -Wextra -Wconversion -Woverloaded-virtual -o main main.cpp