AnsweredAssumed Answered

How to correct C++ version 6.0 and VISA run time error

Question asked by yonasaster on Oct 30, 2008
Latest reply on Nov 5, 2008 by yonasaster
Hello Everyone,

I compiled and linked a VISA program in C++,6.0 environment, with 0 error and 0 warning. But, while excution begins, about 5 errors came
that says: unresolved external symbol _viClose
               unresolved external symbol _viprintf
               unresolved external symbol _viStatusDesc
               unresolved external symbol _viopen
               unresolved external symbol _viOpenDefault

The program is to interupt a DC power supply Egilent model 6654A and the GPIB card is 82351A GPIB interface card. The interuption is about 220ms. some one please help me to resolve such problem.

The C++ code is:
#include <visa.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h> // only used for Sleep function


void main () {
 
  // These variable are neccessary to initialize the VISA system.
  ViSession defaultRM, vi;
  ViStatus status;
  char statusDescription[128];

 

  // This variable is to be used for GPIB communication
  // GPIB0 is the VISA name of the interface
  // The instrument is at address 5
  char IOaddress[]   ="GPIB0::5::INSTR";



  // The default resource manager manages all of the overhead required for VISA
  viOpenDefaultRM (&defaultRM);

  // Opens a communication session with the instrument at address 5
  status = viOpen (defaultRM, IOaddress, VI_NULL,VI_NULL, &vi);

  if (status!=VI_SUCCESS) {
      viStatusDesc(vi,status,statusDescription);
      printf("Error on viOpen: %s \n",statusDescription);
      exit(EXIT_FAILURE);
  }

  // Initialize device
  viPrintf (vi, "*RST\n");

  //Set the voltage
  viPrintf (vi, "VOLT 28\n");

  //Set the current
  viPrintf (vi, "CURR 5\n");

  while(1){
       //Turn Output On
       viPrintf (vi, "OUTP ON\n");
      
      // We need to wait 220ms
      Sleep(220);

      //Turn Output Off
      viPrintf (vi, "OUTP OFF\n");

      // We need to wait 220ms
      Sleep(220);
  }

  // Close session
  viClose (vi);
  viClose (defaultRM);
}  

Outcomes