title: Why am I getting an "unresolved external symbol" message?
body: <p>I am attempting to use IBM's EHLLAPI to interface with their Personal Communicator Terminal Emulator. I have copied their sample code from <a href="http://publib.boulder.ibm.com/infocenter/pcomhelp/v5r9/index.jsp?topic=/com.ibm.pcomm.doc/books/html/emulator_programming07.htm" rel="nofollow">this page</a>, but it's giving me an error when I try to build it. </p>
  
  <pre><code>1&gt;------ Build started: Project: PCOMAPI, Configuration: Debug Win32 ------
  1&gt;  Source.cpp
  1&gt;Source.obj : error LNK2019: unresolved external symbol _hllapi@16 referenced in function _main
  1&gt;C:\Users\[username]\Documents\Visual Studio 2013\Projects\VPARSAPI\Debug\PCOMAPI.exe : fatal error LNK1120: 1 unresolved externals
  </code></pre>
  
  <p>I'm not entirely certain what this _hllapi@16 is, and I'm not seeing it in the code. It has been a while since I've worked with C++, so it may be something simple I'm missing. The code is as follows:</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;windows.h&gt;
  #include "hapi_c.h"
  
  
  int main(char **argv, int argc) {
      int HFunc, HLen, HRc;
      char HBuff[1];
      struct HLDConnectPS ConnBuff;
      // Send Key string for HOME+string+ENTER:
      char SendString[] = "@0Hello World!@E";
  
      HFunc = HA_RESET_SYSTEM;
      HLen = 0;
      HRc = 0;
      hllapi(&amp;HFunc, HBuff, &amp;HLen, &amp;HRc);
      if (HRc != HARC_SUCCESS) {
          printf("Unable to access EHLLAPI.\n");
          return 1;
      }
  
      HFunc = HA_CONNECT_PS;
      HLen = sizeof(ConnBuff);
      HRc = 0;
      memset(&amp;ConnBuff, 0x00, sizeof(ConnBuff));
      ConnBuff.stps_shortname = 'A';
      hllapi(&amp;HFunc, (char *)&amp;ConnBuff, &amp;HLen, &amp;HRc);
      switch (HRc) {
      case HARC_SUCCESS:
      case HARC_BUSY:
      case HARC_LOCKED: // All these are OK
          break;
      case HARC_INVALID_PS:
          printf("Host session A does not exist.\n");
          return 1;
      case HARC_UNAVAILABLE:
          printf("Host session A is in use by another EHLLAPI application.\n");
          return 1;
      case HARC_SYSTEM_ERROR:
          printf("System error connecting to session A.\n");
          return 1;
      default:
          printf("Error connecting to session A.\n");
          return 1;
      }
  
      HFunc = HA_SENDKEY;
      HLen = strlen(SendString);
      HRc = 0;
      hllapi(&amp;HFunc, SendString, &amp;HLen, &amp;HRc);
      switch (HRc) {
      case HARC_SUCCESS:
          break;
      case HARC_BUSY:
      case HARC_LOCKED:
          printf("Send failed, host session locked or busy.\n");
          break;
      default:
          printf("Send failed.\n");
          break;
      }
  
      HFunc = HA_DISCONNECT_PS;
      HLen = 0;
      HRc = 0;
      hllapi(&amp;HFunc, HBuff, &amp;HLen, &amp;HRc);
  
      printf("EHLLAPI program ended.\n");
      return 0;
  }
  </code></pre>
  
  <p>My linker flags are:</p>
  
  <ul>
  <li>/OUT:"C:\Users[username]\Documents\Visual Studio
  2013\Projects\VPARSAPI\Debug\PCOMAPI.exe" /MANIFEST /NXCOMPAT</li>
  <li>/PDB:"C:\Users[username]\Documents\Visual Studio</li>
  <li>2013\Projects\VPARSAPI\Debug\PCOMAPI.pdb" /DYNAMICBASE "kernel32.lib"</li>
  <li>"user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib"</li>
  <li>"shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib"</li>
  <li>"odbccp32.lib" /DEBUG /MACHINE:X86 /INCREMENTAL</li>
  <li>/PGD:"C:\Users[username]\Documents\Visual
  Studio2013\Projects\VPARSAPI\Debug\PCOMAPI.pgd" /SUBSYSTEM:CONSOLE</li>
  <li>/MANIFESTUAC:"level='asInvoker' uiAccess='false'"</li>
  <li>/ManifestFile:"Debug\PCOMAPI.exe.intermediate.manifest"</li>
  <li>/ERRORREPORT:PROMPT /NOLOGO /TLBID:1</li>
  </ul>