title: "Warning: Can't find linker symbol for virtual table for value XXX value" using GCC and GDB (CodeBlocks)
body: <p>I'm getting a runtime error ("memory can't be written") that, after inspection through the debugger, leads to the warning in the tittle. </p>
  
  <p>The headers are the following:</p>
  
  <p>componente.h:</p>
  
  <pre><code>#ifndef COMPONENTE_H
  #define COMPONENTE_H
  
  using namespace std;
  
  class componente
  {
          int num_piezas;
          int codigo;
          char* proovedor;
      public:
          componente();
          componente(int a, int b, const char* c);
          virtual ~componente();
          virtual void print();
  
  };
  
  #endif // COMPONENTE_H
  </code></pre>
  
  <p>complement.h implementation </p>
  
  <pre><code>#include "Componente.h"
  #include &lt;string.h&gt;
  #include &lt;iostream&gt;
  
  componente::componente()
  {
      num_piezas = 0;
      codigo = 0;
      strcpy(proovedor, "");
      //ctor
  }
  
  componente::componente(int a = 0, int b = 0, const char* c = "")
  {
      num_piezas = a;
      codigo = b;
      strcpy(proovedor, "");
  }
  
  componente::~componente()
  {
      delete proovedor;//dtor
  }
  
  void componente::print()
  {
      cout &lt;&lt; "Proovedor: " &lt;&lt; proovedor &lt;&lt; endl;
      cout &lt;&lt; "Piezas:    " &lt;&lt; num_piezas &lt;&lt; endl;
      cout &lt;&lt; "Codigo:    " &lt;&lt; codigo &lt;&lt; endl;
  }
  </code></pre>
  
  <p>teclado.h</p>
  
  <pre><code>#ifndef TECLADO_H
  #define TECLADO_H
  
  #include "Componente.h"
  
  
  class teclado : public componente
  {
          int teclas;
      public:
          teclado();
          teclado(int a, int b, int c, char* d);
          virtual ~teclado();
          void print();
  
  
  };
  
  #endif // TECLADO_H
  </code></pre>
  
  <p>teclado.h implementation</p>
  
  <pre><code>#include "teclado.h"
  #include &lt;iostream&gt;
  
  teclado::teclado() : componente()
  {
      teclas = 0;//ctor
  }
  
  teclado::~teclado()
  {
      teclas = 0;//dtor
  }
  
  teclado::teclado(int a = 0, int b = 0, int c = 0, char* d = "") : componente(a,b,d)
  {
      teclas = c;
  }
  
  void teclado::print()
  {
      cout &lt;&lt; "Teclas: " &lt;&lt; teclas &lt;&lt; endl;
  }
  </code></pre>
  
  <p>The main method where I get the runtime error is the following:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "teclado.h"
  
  using namespace std;
  
  int main()
  {
      componente a; // here I have the breakpoint where I check this warning
      a.print();
      return 0;
  }
  </code></pre>
  
  <p>BUT, if instead of creating an "componente" object, I create a "teclado" object, I don't get the runtime error. I STILL get the warning during debugging, but the program behaves as expected:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "teclado.h"
  
  using namespace std;
  
  int main()
  {
      teclado a;
      a.print();
      return 0;
  }
  </code></pre>
  
  <p>This returns "Teclas = 0" plus the "Press any key..." thing. </p>
  
  <p>Do you have any idea why the linker is having troube with this? It doesn't show up when I invoke the virtual function, but before, during construction.</p>