Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Linker Error while building files refering to NI-DAQ API

Software: MATLAB 5.3
O/S : Windows 98
C Compiler : Microsoft VC++ 6.0

We are trying to make an executable of an Application involving both of MatLab and C Files
The file SCANsingleBufSync2.c is C program calling National Instruments NI-DAQ API's. This C program is called by displayCnt3.m,a MatLab Program. Both of the files are individually compiled using
mcc -x SCANsingleBufSync2.c, ...
That works fine.

When trying to make a build , using
mcc -B sgl displayCnt3 SCANsingleBufSync2.c
it is throwing the following error.(pl. refer section at end)

Basically it is not able to do Link. The MatLab path has been set to look into the NI-DAQ .dlls
C:\Program Files\National Instruments\Ni-daq\Includes and
C:\Program Files\National Instruments\Ni-daq\Lib

Also the Windows path has been set to the above two directories through the autoexec.bat.

Suggestions Please,

Thanks in advace,

MOHANDAS





� mcc -B sgl displayCnt3 SCANsingleBufSync2.c
SCANsingleBufSync2.obj : error LNK2001: unresolved external symbol _DAQ_VScale@40
SCANsingleBufSync2.obj : error LNK2001: unresolved external symbol _SCAN_Demux@16
SCANsingleBufSync2.obj : error LNK2001: unresolved external symbol _SCAN_Op@40
SCANsingleBufSync2.obj : error LNK2001: unresolved external symbol _NIDAQErrorHandler@12
SCANsingleBufSync2.obj : error LNK2001: unresolved external symbol _Timeout_Config@8
displayCnt3.obj : error LNK2001: unresolved external symbol _MdisplayCnt3_SCANsingleBufSync2
displayCnt3.exe : fatal error LNK1120: 6 unresolved externals

MBUILD.BAT: Link of 'displayCnt3.exe' failed.

mcc -B sgl displayCnt counter.c

counter.obj : error LNK2001: unresolved external symbol _Select_Signal@16
counter.obj : error LNK2001: unresolved external symbol _GPCTR_Change_Parameter@16
counter.obj : error LNK2001: unresolved external symbol _GPCTR_Set_Application@12
counter.obj : error LNK2001: unresolved external symbol _NIDAQErrorHandler@12
counter.obj : error LNK2001: unresolved external symbol _GPCTR_Control@12
counter.obj : error LNK2001: unresolved external symbol _GPCTR_Config_Buffer@20
counter.obj : error LNK2001: unresolved external symbol _Set_DAQ_Device_Info@12
counter.obj : error LNK2001: unresolved external symbol _NIDAQYield@4
counter.obj : error LNK2001: unresolved external symbol _GPCTR_Read_Buffer@36
displayCnt.exe : fatal error LNK1120: 9 unresolved externals

MBUILD.BAT: Link of 'displayCnt.exe' failed.
0 Kudos
Message 1 of 2
(2,790 Views)
I'm not very familiar with MATLAB, but you are getting link errors most likely because you aren't linking in the .LIB files for NI-DAQ properly. They are nidaq32.lib and nidex32.lib in the NI-DAQ\lib directory. They need to be linked in with the code to resolve these symbols.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 2
(2,790 Views)