Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>99% of the time a <code>LNK2019</code> means that you forgot to actually fully define the body of a function or a class that you've used somewhere. <strike>Where's the implementation for <code>ToShape()</code>, <code>Sculp()</code>, and <code>CalculateMesh()</code>? What about the constructor and the destructor</strike>?</p> <p>It appears that you are putting the implementations into a <code>.cpp</code> file. While it is understandable that one should separate the interface from the implementation, class templates are completely different beasts from non-templates.</p> <p>The compiler doesn't actually generate any machine code for templates because not all the template parameters have been defined yet. You can't generate the machine code for <code>Sculptor</code> without knowing how big the member array is going to be, for example. The compiler doesn't know in advance that <code>Size == 16</code> when the compiler comes to parsing the template definition. So you get linker errors since the linker can't find the machine code for it; it doesn't exist!</p> <p>For template classes you would typically put the implementation in the template class declaration itself<strike>, so you're probably really are missing those function definitions</strike> like this:</p> <pre><code>template&lt;int Size&gt; class Sculptor { public: Sculptor() { // implementation } // and so on... </code></pre> <p>The templates in the Boost libraries and the C++ Standard Library are defined like this.</p> <hr> <p>A side note: with <code>Size == 16</code>, you're creating a 3x3 array with 4096 <code>unsigned char</code>s in it. While that's not a problem in of itself, it's quite easy to overflow the stack when a single <code>Sculptor</code> occupies at least 4096 <code>unsigned char</code>s on the stack.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload