Error while linking a C++ Application with Virtual Server

29. August 2006 05:51 by Csaborio in General  //  Tags:   //   Comments (0)
While trying to build a C++ application that tried to use the library from Virtual Server library VSComInterfaces.lib, we were getting a linker error that had us baffled for quite some time:

Error     1          error LNK2001: unresolved external symbol _IID_IVMVirtualServer  EnumVMs.obj    
Error     2          fatal error LNK1120: 1 unresolved externals          H:\Virtua\M01\Exercise-6\VMListing\Debug\VMListing.exe          

Searching for an answer in various search engines, only lead us back to where the example source code had originated:  http://windowssdk.msdn.microsoft.com/en-us/library/ms699581.aspx

We had no idea what was going on...we had brought the library from the C:\Program Files\Microsoft Virtual Server\Documentation directory from the server...the server...the x64  server!!!!

A quick check using dumpbin displayed the following info on the lib:


FILE HEADER VALUES
            8664 machine (x64)
               3 number of sections
        43589BDA time date stamp Fri Oct 21 00:42:18 2005
             57D file pointer to symbol table
              47 number of symbols
... 


We quickly compiled to 64-bit to see if the 64-bit library was indeed the culprit.  The app compiled without any problems!!

Bringing over the 32-bt lib file from a 32-bit Virtual Server allowed us to create the 32-bit version of the application and everything is back to normal.

Hopefully someone will find this post if they ever encounter the same problem in the future.