title: C++ constructor default value header file
body: <p>I'm trying to create a constructor with a default value. The complication comes from the use of separate header and code files for the class. I've got a header file that contains:</p>
  
  <pre><code>class foo {
      bool dbg;
      public:
          foo(bool debug = false);
  }
  </code></pre>
  
  <p>And a code file containing:</p>
  
  <pre><code>foo::foo(bool debug = false) {
      dbg = debug;
  }
  </code></pre>
  
  <p>When I try and compile with g++ (i.e. <code>g++ -c foo.cc</code>), it gives an error:</p>
  
  <pre><code>foo.cc:373:65: error: default argument given for parameter 1 of ‘foo::foo(bool)’
  foo.h:66:4: error: after previous specification in ‘foo::foo(bool)’
  </code></pre>
  
  <p>What am I doing wrong?</p>