title: What is the purpose of __cxa_pure_virtual?
body: <p>Whilst compiling with avr-gcc I have encountered linker errors such as the following:</p>
  <pre><code>undefined reference to `__cxa_pure_virtual'
  </code></pre>
  <p>I've found <a href="http://ccgi.rowley.co.uk/support/faq.php?do=article&amp;articleid=127" rel="noreferrer">this document</a> which states:</p>
  <blockquote>
  <p>The <code>__cxa_pure_virtual</code> function is an error handler that is invoked when a pure virtual function is called.</p>
  <p>If you are writing a C++ application that has pure virtual functions you must supply your own <code>__cxa_pure_virtual</code> error handler function. For example:</p>
  <p><code>extern &quot;C&quot; void __cxa_pure_virtual() { while (1); }</code></p>
  </blockquote>
  <p>Defining this function as suggested fixes the errors but I'd like to know:</p>
  <ul>
  <li>what the purpose of this function is,</li>
  <li>why I should need to define it myself and</li>
  <li>why it is acceptable to code it as an infinite loop?</li>
  </ul>