Quantcast
Channel: VMware Communities : Popular Discussions - VIX API
Viewing all articles
Browse latest Browse all 34639

Getting Errors while trying to use vmware API in c program

$
0
0

On Linux VMware server

I am trying to run a c program to connect to host; getting compilation errors

 

/tmp/ccAvWkKp.o: In function `main':

test.c:(.text+0x6f): undefined reference to `VixHost_Connect'

test.c:(.text+0x94): undefined reference to `VixJob_Wait'

test.c:(.text+0xaf): undefined reference to `Vix_ReleaseHandle'

test.c:(.text+0xc1): undefined reference to `VixHost_Disconnect'

collect2: ld returned 1 exit status

 

 

Here is the code

 

#include <vmware-vix/vix.h>

 

\### Get host handle

int main(int argc, char * argv[])

{

   VixHandle hostHandle = VIX_INVALID_HANDLE;

   VixHandle jobHandle = VIX_INVALID_HANDLE;

   VixError err;

 

   // Connect as specified user on local host.

   jobHandle = VixHost_Connect(VIX_API_VERSION,

                               VIX_SERVICEPROVIDER_VMWARE_SERVER,

                               NULL, // hostName

                               0, // hostPort

                               NULL,  // userName

                               NULL, // password,

                               0, // options

                               VIX_INVALID_HANDLE, // propertyListHandle

                               NULL, // callbackProc

                               NULL); // clientData

   err = VixJob_Wait(jobHandle,

                     VIX_PROPERTY_JOB_RESULT_HANDLE,

                     &hostHandle,

                     VIX_PROPERTY_NONE);

   if (VIX_OK != err) {

      // Handle the error...

      goto abort;

   }

   Vix_ReleaseHandle(jobHandle);

   jobHandle = VIX_INVALID_HANDLE;

   // Other code goes here...

 

abort:

   VixHost_Disconnect(hostHandle);

}

 

Any help is appreciated.


Viewing all articles
Browse latest Browse all 34639

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>