Reputation: 35984
I am using the following command to build C++14.
g++ -std=c++14 -O2 -Wall -pedantic -pthread main.cpp && ./a.out
How to add the -Wunused-variable
to the above line so that all warnings except -Wunused-variable
are shown?
Upvotes: 1
Views: 958
Reputation: 302718
From the gcc docs:
You can request many specific warnings with options beginning with ‘
-W
’, for example-Wimplicit
to request warnings on implicit declarations. Each of these specific warning options also has a negative form beginning ‘-Wno-
’ to turn off warnings; for example,-Wno-implicit
.
So to disable the unused variable warning, you would pass -Wno-unused-variable
Upvotes: 2