title: LNK2001 unresolved external when importing functions from MFC DLL
body: <p>I have created an MFC DLL and have exported the functions for example in the file SerialPort.h:</p>
  
  <pre><code>class CSerialPortApp : public CWinApp
  {
  public:
      CSerialPortApp();
  
      __declspec(dllexport) int SWrite(unsigned char* toSend, int len);
  };
  </code></pre>
  
  <p>and in my MFC application I want to call the function in SerialInterface.h I have included the "SerialPort.h" from the DLL and called:</p>
  
  <pre><code>__declspec(dllimport) int SWrite(unsigned char* toSend, int len);
  
  class SerialInterface
  {
  public:
  
  };
  </code></pre>
  
  <p>for example.</p>
  
  <p>I have added the SerialPort.lib file to my linker includes but when I try to compile I get</p>
  
  <pre><code>error LNK2001: unresolved external symbol "__declspec(dllimport) int __cdecl SWrite(unsigned char*, int)" (__imp_?SWrite@@YAHPAEH@Z)
  </code></pre>
  
  <p>I am stuck as to the cause of this, I have tried rebuilding everything but nothing seems to help?</p>
  
  <p>Thank you for any help!</p>