title: C++ include guard doesn't appear to work?
body: <p>I have used include guards many times before, but never really understood how or why they work.</p>
  
  <p>Why doesn't the following work?</p>
  
  <pre><code>#ifndef CAMERA_CLASS_HPP
  #define CAMERA_CLASS_HPP
  
  
  class camera_class
  {
  ....
  };
  
  camera_class glcam = camera_class();
  
  
  #endif // CAMERA_CLASS_HPP
  </code></pre>
  
  <p>The error is this: (You can probably guess what it's going to be from the title of this question!)</p>
  
  <pre><code>-------------- Build: Debug in System ---------------
  
  Linking console executable: bin/Debug/System
  /usr/bin/ld: error: obj/Debug/main.o: multiple definition of 'glcam'
  /usr/bin/ld: obj/Debug/camera_class.o: previous definition here
  /usr/bin/ld: error: obj/Debug/main.glfunc.o: multiple definition of 'glcam'
  /usr/bin/ld: obj/Debug/camera_class.o: previous definition here
  collect2: ld returned 1 exit status
  Process terminated with status 1 (0 minutes, 0 seconds)
  0 errors, 0 warnings
  </code></pre>
  
  <p>Also, could someone please explain to me why a header guard works?</p>