Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meaning of g++ flags -Wall -W -Werror

What are these and what do they do?

-Wall -W -Werror

I am using terminal in Ubuntu to compile programs with this command:

$ g++ -Wall -W -Werror main.cpp -o exec

Could anyone explain this to me?

like image 567
Mudit Kapoor Avatar asked Mar 25 '15 11:03

Mudit Kapoor


People also ask

What is the G flag for terminal?

the -g flag means install the package globally on your system.

What is G flag in npm?

the -g flag is a shorthand for the global configuration which sets the package install location to the folder where you installed NodeJS. This is useful when you need to run the package from the command line instead of using require() and import it to your code.

What effect does the G flag have on a regular expression?

The "g" flag indicates that the regular expression should be tested against all possible matches in a string. Without the g flag, it'll only test for the first. So the /g flag is irrelevant when using the .

What is s flag in npm?

The 'S' option is the Save option in npm. It adds the npm package to your dependencies for your project. It's the same as --save .


1 Answers

-Wall: enable a set of warning, actually not all.
-W: enable extra warning, it's advised to use -Wextra instead which has the same meaning
-Werror: every warning is treated as an error.

See GCC documentation: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#Warning-Options

like image 199
usr1234567 Avatar answered Sep 30 '22 21:09

usr1234567