title: Unresolved external symbol in C++ MFC library
body: <p>I am trying to implement a DLL into my application, but it passed some time since I've written C++, so I have some troubles here...
  My class in DLL uses the resource file specific to that project. Here you can see my code:</p>
  
  <pre><code>// ErrorHandler.h (in Resources.dll - an MFC Library)
  
  namespace HandWritten
  {
      class ErrorHandler
      {
      private:
          unsigned int m_error_id;
          string get_error_text();
          string get_error_code();
      public:
          ErrorHandler(unsigned int error_id);
          ~ErrorHandler();
      };
  }
  </code></pre>
  
  <p>I have created a console application, with MFC headers included, that has to test the functionality inside my library. This the main source file of the tester:</p>
  
  <pre><code>CWinApp theApp;
  
  using namespace std;
  
  int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
  {
      int nRetCode = 0;
  
      HMODULE hModule = ::GetModuleHandle(NULL);
  
      if (hModule != NULL)
      {
          // initialize MFC and print and error on failure
          if (!AfxWinInit(hModule, NULL, ::GetCommandLine(), 0))
          {
              // TODO: change error code to suit your needs
              _tprintf(_T("Fatal Error: MFC initialization failed\n"));
              nRetCode = 1;
          }
          else
          {
              // TODO: code your application's behavior here.
          }
      }
      else
      {
          // TODO: change error code to suit your needs
          _tprintf(_T("Fatal Error: GetModuleHandle failed\n"));
          nRetCode = 1;
      }
  
      new HandWritten::ErrorHandler(30001);
  
      return nRetCode;
  }
  </code></pre>
  
  <p>The error I get from the compiler is here:</p>
  
  <pre><code>error LNK2019: unresolved external symbol "public: __thiscall HandWritten::ErrorHandler::ErrorHandler(unsigned int)" (??0ErrorHandler@HandWritten@@QAE@I@Z) referenced in function _wmain   E:\Applications\HandWritten\Tester\Tester.obj   Tester
  </code></pre>
  
  <p>Please help me with this because I will get crazy if it doesn't work...</p>
  
  <p>*<em>EDIT: *</em> The implementation of the class contructor:</p>
  
  <pre><code>namespace HandWritten {
      ErrorHandler::ErrorHandler(unsigned int error_id) : m_error_id{error_id}
      {
          string content(MAKEINTRESOURCEA(error_id));
          MessageBoxA(NULL, content.c_str(), "Ok", MB_OK);
      }
  }
  </code></pre>