Can anybody explain this..

I've been using g++ -Wall -W -Werror ____________.cpp -o _________
to compile my code into an executable...

I recently forgot the -Wall -W -Werror and just tried g++ _______.cpp -o ________
and it worked just the same.

What's the difference between them other than one being extremely shorter?
what it does to check the file
I use the -std=c++11 -Wall -Wextra -pedantic options.

The first one makes the compiler cope with the C++ 2011 standard - That is letting you do C++11 code - but don't worry about that for now.

-Wall prints out most of the errors in your code.
-Wextra does even more errors that strangely aren't included in -Wall
-pedantic does even further errors, but these are still handy sometimes

If you leave out these options, the compiler won't warn you about as many potential problems, there is a bit of a default level of

The gcc man page has zillions of options, but these ones will do for most things.

The description of warnings start at line 2078 of gcc man on my system. It worth reading some of this - although rather boring.

Hope all goes well
Last edited on
Oh alright, thanks! having fun learning C++ so far !(:
hey lets just write code without any errors then we dont need the error options!
Topic archived. No new replies allowed.