发表于:2005-03-08 16:46:00
楼主
通过对simp.cpp的编译和链接后,出现如下错误:
Info :Compiling C:\dos\hp34401a\bc20\simp.cpp
Info :Linking C:\bc5\bin\simp.exe
Error:Error: Unresolved external 'ibfind(char*)' referenced from module ..\..\dos\hp34401a\bc20\simp.cpp
Error:Error: Unresolved external '_ibsta' referenced from module ..\..\dos\hp34401a\bc20\simp.cpp
Error:Error: Unresolved external 'ibdev(int,int,int,int,int,int)' referenced from module ..\..\dos\hp34401a\bc20\simp.cpp
Error:Error: Unresolved external '_iberr' referenced from module ..\..\dos\hp34401a\bc20\simp.cpp
Error:Error: Unresolved external 'ibonl(int,int)' referenced from module ..\..\dos\hp34401a\bc20\simp.cpp
Error:Error: Unresolved external 'ibwrt(int,char*,long)' referenced from module ..\..\dos\hp34401a\bc20\simp.cpp
Error:Error: Unresolved external 'ibwait(int,int)' referenced from module ..\..\dos\hp34401a\bc20\simp.cpp
Error:Error: Unresolved external 'ibrd(int,char*,long)' referenced from module ..\..\dos\hp34401a\bc20\simp.cpp
Error:Error: Unresolved external '_ibcntl' referenced from module ..\..\dos\hp34401a\bc20\simp.cpp
Error:Error: Unresolved external 'ibloc(int)' referenced from module ..\..\dos\hp34401a\bc20\simp.cpp
以下两行是编写的( *. prj )文件:
c:\dos\hp34401a\bc20\simp.cpp
c:\dos\hp34401a\bc20\ax4810.lib
以下是资料光盘上的应用例子,在Broland C++ 5.0下对它(simp.cpp)编译和链接后,就出现上面显示的错误,
请问:怎样编写程序才能将AX4810.H和AX4810.LIB链接到应用例子中去呢?
/* simple.cpp : Defines the entry point for the console application. */
/* AXIOMTEK AX4810 PCI GPIB CARD SAMPLE PROGRAM */
/* Communicating to HP 34401A DMM */
/* Note: */
/* Before testing, please check the connection between */
/* GPIB card and DMM is ok, and the GPIB address of DMM */
/* should be 2. */
/*#include "stdafx.h"*/
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
/*//#include <malloc.h>
//#include <memory.h>
//#include <direct.h>*/
/*#include <windows.h>*/
#include "c:\dos\hp34401a\bc20\ax4810.h"
int TestProc()
{
int dmm; /*/ file descriptor for digital multimeter*/
int i;
char reading[255] = {0}; /*/ stores measurement readings from DMM*/
printf("\n\n\n\nAXIOMTEK Ax4810 PCI GPIB Card Sample Program Begin...\n\n");
ibfind("gpib0");
if(ibsta&ERR)
{
printf("\n\nAx4810 board installed incorrectly or cann't work!");
printf("\nTest fail!\n\n");
return(0);
}
if ((dmm = ibdev(0, 2, 0, T100ms, 1, 0x140A)) < 0) /*/ DMM's address is 2*/
{
printf("\n\nError %d: %s\n", iberr, "Error of ibdev");
if (dmm != -1)
{
/*/ printf("Cleanup: taking board off-line\n");*/
ibonl(dmm,0);
}
printf("\n\nCould not open DMM or could not find Ax4810 board!");
printf("\nTest fail\n\n");
return(0);
}
/*/ Set up DMM to measure VDC, auto-range*/
ibwrt(dmm, ":conf:volt:dc", 13L);
if (ibsta & ERR)
printf("\nCould not initialize DMM");
/*/ Take 10 readings*/
for (i=0; i < 10; i++)
{
/*// Request voltage reading from DMM*/
ibwrt(dmm, ":meas?", 6L);
if (ibsta & ERR)
printf("\nCould not trigger multimeter");
/*/ Read data from DMM*/
ibwait(dmm,TIMO); /*/ Wait DMM finish reading*/
ibrd(dmm, reading, 20L);
if (ibsta & ERR)
printf("\nCould not read data from multimeter");
/*/ Null terminate the string*/
reading[ibcntl-1]='\0';
printf("\n\ndata = %s", reading);
}
/*/ Take DMM off-line*/
ibloc(dmm);
ibonl(dmm, 0);
printf("\n\n\n\nAx4810 Sample Program End\n\n");
return (0);
}
void main()
{
TestProc();
return;
}