title: Is it possible to declare constexpr class in a header and define it in a separate .cpp file?
body: <p>I have a class <code>Dimension</code> which I defined (like all my classes) in a file Dimension.h:</p>
  
  <pre><code>class Dimension
  {
  public:
  
      constexpr Dimension() noexcept;
  
      constexpr Dimension(int w, int h) noexcept;
  
      int width;
      int height;
  
  };
  </code></pre>
  
  <p>I thought I could, like in all my classes, put the definition in a separate Dimension.cpp:</p>
  
  <pre><code>#include "Dimension.h"
  
  constexpr Dimension::Dimension() noexcept : width(0), height(0) {}
  
  constexpr Dimension::Dimension(int w, int h) noexcept : width(w), height(h) {}
  </code></pre>
  
  <p>But when I try to use the class, the compiler tells me:</p>
  
  <p>warning: inline function '<code>constexpr Dimension::Dimension()</code>' used but never defined</p>
  
  <p>and while linking:</p>
  
  <p>undefined reference to '<code>pong::graphics::Dimension::Dimension()</code>'</p>
  
  <p>(same with the other constructor)</p>
  
  <p>If I define the class in the header like so:</p>
  
  <pre><code>class Dimension
  {
  public:
  
      constexpr Dimension() noexcept : width(0), height(0) {}
  
      constexpr Dimension(int w, int h) noexcept : width(w), height(h) {}
  
      int width;
      int height;
  
  };
  </code></pre>
  
  <p>and omit the .cpp file, everything works fine.</p>
  
  <p>I'm using GCC 4.9.2. Why does separate definition not work?</p>