g++ generates warnings for unused local variables. Is it possible to have g++ warn for unused class member variables and/or global variables?
class Obj { public
You can use cppcheck (download). cppcheck --enable=style does exactly what you need, among other useful things.
cppcheck --enable=style