title: Referencing GUIDs
body: <p>I'm trying to capture an event and reference a GUID to see which event it is.  The code is below:</p>
  
  <pre><code>DWORD WINAPI AvisionEventProc(LPVOID lpParam){
      //HANDLE hEvent = * (HANDLE *) lpParam;   // This thread's read event
      STINOTIFY pStiNotify;
  
      if (debug){
          wprintf(L"Avision Event\n");
      }
      while(true){
          WaitForSingleObject(hAvisionEvent, INFINITE);
          wprintf(L"Event");
          pStiDevice-&gt;GetLastNotificationData(&amp;pStiNotify);
          if (pStiNotify.guidNotificationCode == GUID_STIUserDefined1){
              wprintf(L"User defined 1");
          }else if (pStiNotify.guidNotificationCode == GUID_STIUserDefined2){
              wprintf(L"User defined 2");
          }else if (pStiNotify.guidNotificationCode == GUID_STIUserDefined3){
              wprintf(L"User defined 3");
          }
  
          ResetEvent(hAvisionEvent);
      }
      return 1;
  }
  </code></pre>
  
  <p>This compiles just fine but I get the errors below when linking:</p>
  
  <pre><code>1&gt;sti.obj : error LNK2001: unresolved external symbol _GUID_STIUserDefined3
  1&gt;sti.obj : error LNK2001: unresolved external symbol _GUID_STIUserDefined2
  1&gt;sti.obj : error LNK2001: unresolved external symbol _GUID_STIUserDefined1
  </code></pre>
  
  <p>The strange thing is that sti.h is linked in as I am pulling other constants from it.  I did notice by the GUID decleration the following:</p>
  
  <pre><code>#if defined( _WIN32 ) &amp;&amp; !defined( _NO_COM)
  
  /*
   * Class IID's
   */
  
  // B323F8E0-2E68-11D0-90EA-00AA0060F86C
  DEFINE_GUID(CLSID_Sti, 0xB323F8E0L, 0x2E68, 0x11D0, 0x90, 0xEA, 0x00, 0xAA, 0x00, 0x60, 0xF8, 0x6C);
  
  /*
   * Interface IID's
   */
  
  // {641BD880-2DC8-11D0-90EA-00AA0060F86C}
  DEFINE_GUID(IID_IStillImageW, 0x641BD880L, 0x2DC8, 0x11D0, 0x90, 0xEA, 0x00, 0xAA, 0x00, 0x60, 0xF8, 0x6C);
  
  &lt;snip&gt;
  
  /*
   * Standard event GUIDs
   */
  
  // {740D9EE6-70F1-11d1-AD10-00A02438AD48}
  DEFINE_GUID(GUID_DeviceArrivedLaunch, 0x740d9ee6, 0x70f1, 0x11d1, 0xad, 0x10, 0x0, 0xa0, 0x24, 0x38, 0xad, 0x48);
  
  &lt;snip&gt;
  
  #endif
  </code></pre>
  
  <p>Does the "if defined" line stop the GUIDs being referenced (I am writing a win32 console app) or is there something more fundamental I have wrong here to do with a lack of understanding on GUIDs?</p>
  
  <p>Thanks, in advance for your help.</p>
  
  <p>Cheers,</p>
  
  <p>Neil</p>