title: Class called RGB in Visual C++
body: <p>I'm working on a cross-platform open-source project. Up till now it was not a problem to have a class called <code>RGB</code> in namespace <code>rgb</code>. Now I observe a strange problem with the Microsoft compiler (VS 2010).</p>
  
  <p>When I declare the class, the preprocessor complains about a macro being misused. I get it that a crude <code>RGB</code> macro is defined in WinGdi.h. Whoever found that reasonable, but whatever. So at the top of rgb.h I do:</p>
  
  <pre><code>#undef RGB
  
  namespace rgb {
  
    class RGB : public shell::Command {
    public:
      RGB();
    };
  }
  </code></pre>
  
  <p>This solves the problem for compiling the rgb.cpp object. However, at another place I  want to instantiate an object:</p>
  
  <pre><code>#include "rgb.h"
  
  namespace shell {
  
    Modules::Modules() {
      Command *c;
      c = new rgb::RGB(); // errors at this line
    }
  }
  </code></pre>
  
  <p>I get the error messages:
  Error   19  error C2589: '(' : illegal token on right side of '::'
  Error   20  error C2059: syntax error : '::'
  at the denoted line</p>
  
  <p>How can I fix this issue?</p>