Hello,
There is a link error when i get attempt to build a execution file. my operations are in terms of the follows(copy from visa user guide):
Linking to VISA Libraries
Microsoft Visual C++ Version 6.0 Development Environment
1Use the File menu to create a new project or open an existing project.
2Select Project > Settings from the menu and click the C/C++ tab.
3Select Code Generation from the Category list box and select Multi-Threaded using DLL from the Use Run-Time Libraries list box. (VISA requires these definitions for Win32.) Click OK to close the dialog box.
4Select Project > Settings from the menu. Click the Link tab and add visa32.lib to the Object/Library Modules list box. Optionally, you may add the library directly to your project file. Click OK to close the dialog box.
5You may want to add the include files and library files search paths. They are set as follows:Your application must link to the VISA import library as follows, assuming default installation directories and Microsoft compilers: C:\Program Files\VISA\winnt\lib\msc\visa32.lib The following steps will help you do this. This information is specific to your development environment.
•Select Tools > Options from the menu.
•Click the Directories tab to set the include file path.
•Select Include Files from the Show Directories For list box.
•Click at the bottom of the list box and type: C:\Program Files\VISA\winnt\include(This assumes that you used the default installation location for VISA.)
•Select Library Files from the Show Directories For list box.
•Click at the bottom of the list box and type: C:\Program Files\VISA\winnt\lib\msc(This assumes that you used the default installation location for VISA.)
6Add or create your C or C++ source files. For example, to build the sample described below, select Project > Add to Project > Files... and type or browse to C:\Program Files\Agilent\IO Libraries Suite\ ProgrammingSamples\C\VISA\idn.c.
7Click Build > Rebuild All to build the VISA program.
and the code are as below,
#include <visa.h>#include <stdio.h>
void main () {
ViSession defaultRM, vi;char buf [256] = {0};
/* Open session to GPIB device at address 22 */viOpenDefaultRM(&defaultRM);viOpen(defaultRM, "GPIB0::22::INSTR",VI_NULL,VI_NULL, &vi);
/* Initialize device */viPrintf(vi, "*REST\na");
/* Send an *iodin? string to the device */viPrintf(vi, "*IDN?\n");
/* Read results */viScanf(vi, "%t", buf);
/* Print results */printf("Instrument identification string:
%s\n", buf);
/* Close session */viClose(vi);viClose(defaultRM)
after compiler, link error occurred, "cannot open visa32.lib" message were shown.
how to deal with the trouble, advice please, thanks in advance.
Liu,Yutong
There is a link error when i get attempt to build a execution file. my operations are in terms of the follows(copy from visa user guide):
Linking to VISA Libraries
Microsoft Visual C++ Version 6.0 Development Environment
1Use the File menu to create a new project or open an existing project.
2Select Project > Settings from the menu and click the C/C++ tab.
3Select Code Generation from the Category list box and select Multi-Threaded using DLL from the Use Run-Time Libraries list box. (VISA requires these definitions for Win32.) Click OK to close the dialog box.
4Select Project > Settings from the menu. Click the Link tab and add visa32.lib to the Object/Library Modules list box. Optionally, you may add the library directly to your project file. Click OK to close the dialog box.
5You may want to add the include files and library files search paths. They are set as follows:Your application must link to the VISA import library as follows, assuming default installation directories and Microsoft compilers: C:\Program Files\VISA\winnt\lib\msc\visa32.lib The following steps will help you do this. This information is specific to your development environment.
•Select Tools > Options from the menu.
•Click the Directories tab to set the include file path.
•Select Include Files from the Show Directories For list box.
•Click at the bottom of the list box and type: C:\Program Files\VISA\winnt\include(This assumes that you used the default installation location for VISA.)
•Select Library Files from the Show Directories For list box.
•Click at the bottom of the list box and type: C:\Program Files\VISA\winnt\lib\msc(This assumes that you used the default installation location for VISA.)
6Add or create your C or C++ source files. For example, to build the sample described below, select Project > Add to Project > Files... and type or browse to C:\Program Files\Agilent\IO Libraries Suite\ ProgrammingSamples\C\VISA\idn.c.
7Click Build > Rebuild All to build the VISA program.
and the code are as below,
#include <visa.h>#include <stdio.h>
void main () {
ViSession defaultRM, vi;char buf [256] = {0};
/* Open session to GPIB device at address 22 */viOpenDefaultRM(&defaultRM);viOpen(defaultRM, "GPIB0::22::INSTR",VI_NULL,VI_NULL, &vi);
/* Initialize device */viPrintf(vi, "*REST\na");
/* Send an *iodin? string to the device */viPrintf(vi, "*IDN?\n");
/* Read results */viScanf(vi, "%t", buf);
/* Print results */printf("Instrument identification string:
%s\n", buf);
/* Close session */viClose(vi);viClose(defaultRM)
after compiler, link error occurred, "cannot open visa32.lib" message were shown.
how to deal with the trouble, advice please, thanks in advance.
Liu,Yutong
There is a good chance that your VISA library is installed in a different location than what is specified in the User's Guide. You can find the include and lib directories by running the following vbscript (also, see attachment)
This vbscript will work no matter which version of the IO Libraries Suite you have installed. It will also work if you have NI VISA installed.
hognala