title: How to solve error LNK2019: unresolved external symbol
body: <p>Such quite small program drives me crazy. I always get the following error messages:</p>
  
  <pre><code>Error   1   error LNK2019: unresolved external symbol "public: class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; __thiscall ErstesPraktikum::createNameString(class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt;,class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt;,class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt;,int)" (?createNameString@ErstesPraktikum@@QAE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V23@00H@Z) referenced in function _main    Praktikum_gra.obj   GRA
  Error   2   fatal error LNK1120: 1 unresolved externals C:\Users\xxx\Documents\Visual Studio 2008\Projects\GRA\Debug\GRA.exe    GRA
  </code></pre>
  
  <p>Here is me program, which contains the classes <em>ErstesPraktikum</em> and <I>Praktikum_gra</I> plus the corresponding header files.</p>
  
  <p>I just want to use the <I>Praktikum_gra Class</I> to call methods of the <em>ErstesPraktikum Class</em>. I spent hours in resolving this error, but without success. Is that a programming mistake or a configuration problem ? My last hope is that someone of you can give me a hint...</p>
  
  <p>Note: <em>String</em> is just a wrapper for <em>std::string</em> of openCV.</p>
  
  <p><strong>ErstesPraktikum.h</strong></p>
  
  <pre><code>#include &lt;opencv2\core\core.hpp&gt;
  
  using namespace std;
  using namespace cv;
  
  class ErstesPraktikum
  {
      private:
          String convertInteger(int);
  
      public:
          String createNameString(String, String, String, int);
          void readImage(String, Mat *);
          void extractObjects(int, Mat *, Mat *);
  };
  </code></pre>
  
  <p><strong>ErstesPraktikum.cpp</strong></p>
  
  <pre><code>#include &lt;opencv2\core\core.hpp&gt;
  #include &lt;opencv2\highgui\highgui.hpp&gt;
  #include &lt;opencv2\imgproc\imgproc.hpp&gt;
  #include &lt;fstream&gt;
  
  using namespace std;
  using namespace cv;
  
  
  String convertInteger(int value) 
  {
      stringstream ss;
      ss &lt;&lt; value;
      return ss.str();
  }
  
  String createNameString(String path, String fileName, String fileExtension, int buildNumber)
  {
      String pathString = path.append(fileName);
      pathString = pathString.append(".");
      pathString = pathString.append(convertInteger(buildNumber));
      pathString = pathString.append(".");
      pathString = pathString.append(fileExtension);
  
      return pathString;
  }
  
  void readImage(String nameString, Mat * image) 
  {
     double mn = 0, mx = 0;
     image = &amp;cv::Mat(cv::Size(512, 512), IPL_DEPTH_8U, 1);
     unsigned short *data;
     data = (unsigned short *)image-&gt;data;
     FILE *file;
     file = fopen(nameString.c_str(), "rb");
  
     fseek(file, 1340, SEEK_SET);
     fread(data, sizeof(unsigned short)*512*512, 1, file);
     fclose(file);
  
  
     //cv::cvSmooth(Image,Image);
  
     //cv::minMaxLoc(image, &amp;mn, &amp;mx, NULL, NULL, 0);
     //cv::convertScaleAbs(image, *target, 255/mx, -mn*255/mx);
  }
  
  void extractObjects(int threshold, Mat * img, Mat * binImg) 
  {
  
  }
  </code></pre>
  
  <p><strong>Praktikum_gra.h</strong></p>
  
  <pre><code>class Praktikum_gra
  {
      public:
          int main(void);
  }
  </code></pre>
  
  <p><strong>Praktikum_gra.cpp</strong></p>
  
  <pre><code>#include "ErstesPraktikum.h"
  
  using namespace std;
  using namespace cv;
  
      int main(void)
      { 
          String path("C:\\Users\\xxx\\xxx\\xxx\\GRA P1\\Head_M\\");
          String fileName("vhm");
          String fileExtension("dcm");
          ErstesPraktikum prak;
  
          for(int i = 1001; i &lt;= 1245; i++) 
          {
              String nameString = prak.createNameString(path, fileName, fileExtension, i); // this line is the cause of the error message, but why ?
          }
  
          return 0;
      }
  </code></pre>
  
  <p>I already tried to add a class prefix to all methods like:</p>
  
  <pre><code>String ErstesPraktikum::createNameString(String path, String fileName, String fileExtension, int buildNumber)
  {
      // [...]
  }
  </code></pre>
  
  <p>But this throws another error message:</p>
  
  <pre><code>Error   1   error C2653: 'ErstesPraktikum' : is not a class or namespace name   c:\users\xxx\documents\visual studio 2008\projects\gra\gra_u1\erstespraktikum.cpp   17  GRA
  </code></pre>