title: How to get g++ to warn on unused member variables
body: <p>g++ generates warnings for unused local variables. Is it possible to have g++ warn for unused class member variables and/or global variables?</p>
  
  <pre><code>class Obj {
   public:
    Obj(int a, int b) : num1(a), num2(b) {}
    int addA(int i) {
      return i + num1;
    }
  
   private:
    int num1;
    int num2;
  };
  </code></pre>
  
  <p>How do I get g++ to warn me that <code>num2</code> is unused?</p>
  
  <p>UPDATE:
  I am currently compiling with:</p>
  
  <pre><code>g++ -Wall -Wextra -pedantic *.cc -o myprogram 
  </code></pre>