title: "Undefined Symbols" when inheriting from stdexcept classes
body: <p>Here is an exception defined in <code>&lt;stdexcept&gt;</code>:</p>
  
  <pre><code>class length_error : public logic_error 
  {
  public:
      explicit length_error(const string&amp;  __arg);
  };
  </code></pre>
  
  <p>Here is my exception:</p>
  
  <pre><code>#include &lt;string&gt;
  #include &lt;stdexcept&gt;
  using namespace std;
  
  class rpn_expression_error : public logic_error
  {
  public:
      explicit rpn_expression_error(const string&amp; __arg);
  };
  </code></pre>
  
  <p>Why do I get this error when <code>&lt;stdexcept&gt;</code> does not?</p>
  
  <pre><code>Undefined symbols:
    rpn_expression_error::rpn_expression_error(/*string*/ const&amp;), referenced from:
          ...
  ld: symbol(s) not found
  </code></pre>
  
  <p>At @<em>sbi</em>'s request, here is a minimal example of my code at the moment:</p>
  
  <pre><code>#include &lt;string&gt;
  #include &lt;iostream&gt;
  #include &lt;stdexcept&gt;
  using namespace std;
  
  class RPN_Calculator {
  public:
      class rpn_expression_error : public logic_error {
      public:
          explicit rpn_expression_error(const string&amp; arg) : logic_error(arg) {}
      };
  
      void Execute() {
          throw rpn_expression_error("Hello");
      }
  };
  
  int main() {
      RPN_Calculator calc;
  
      try {
          calc.Execute();
      } catch (exception e) {
          cout &lt;&lt; e.what() &lt;&lt; endl;
      }
  }
  </code></pre>
  
  <p>I saved this as <code>rpn.cpp</code> and ran <code>make rpn</code><strike>to produce the error</strike>. </p>
  
  <p><strong>The code now builds completely,</strong> however, the real program still gives me the original error.</p>
  
  <p><strong>Note/Solution:</strong> Although the code above runs just fine, the same exception class in the real code <em>still</em> produces the linker error. To simplify, I just promoted <code>rpn_expression_error</code> to its own global-scope class, and that seems to have fixed the problem.</p>