Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

nidaqmx library ansi versus msvc

Hello all,
 
I am trying to figure out how to combine Ni-DAQmx with matlab. Where I have a license for LabWindows/CVI, I want to build a so-called mex-DLL with the matlab compiler LCC. I succeeded but do not know why!
 
First I tried to build/link a NI-DAQmx application with the use of nidaqmx.h and nidaqmx.lib from the subdirectory \Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\lib\msvc. This did not work.  I got an error that there are undefined references in the object file e.g. undefined reference to '_DAQmxReadAnalogF64@36'.
Next I used a different library from \Program Files\National Instruments\CVI80\extlib\msvc. This one did work.
 
I did not change the path for the include, but made a copy of the h-file and lib-file to the defaults for LCC.
I did change the linker-options for LCC ie added nidaqmx.lib to the list of libraries.
 
How come that the ansi-c version did not work ?
Can I correct this e.g. with a define or an extral include ? Or do I need the Labwindows extlib version ?
 
Jos
 
0 Kudos
Message 1 of 4
(3,338 Views)

Hi Jos,

The extlib in CVI is for use with external compilers, this contains all symbols that any external compiler would need to resolve any function calls.

the library from the NI-DAQmx folder is optimized for use with MSVC and does not contain these simbols.

Hope this helps.

Thanks

Karsten

0 Kudos
Message 2 of 4
(3,298 Views)

I have a similar 'external compiler' linking problem with the nidaqmx library. I purchased a NI DAQ and installed nidaqmx v14.  I successfully compiled a C++ application using msvc 2013. However, when I try to compile the application using the open source compiler, gcc to create an oct file under Octave similar to above Matlab process it compiles but I get similar linking errors:

 

octave:8> mkoctfile AcqIntClk.cc
AcqIntClk.o: In function `Z10FAcqIntClkRK17octave_value_listi':
c:\Octave\Octave3.6.4_gcc4.6.2/AcqIntClk.cc:67: undefined reference to `DAQmxCreateTask@8'
c:\Octave\Octave3.6.4_gcc4.6.2/AcqIntClk.cc:68: undefined reference to `DAQmxCreateAIVoltageChan@40'
c:\Octave\Octave3.6.4_gcc4.6.2/AcqIntClk.cc:69: undefined reference to `DAQmxCfgSampClkTiming@32'
c:\Octave\Octave3.6.4_gcc4.6.2/AcqIntClk.cc:74: undefined reference to `DAQmxStartTask@4'
c:\Octave\Octave3.6.4_gcc4.6.2/AcqIntClk.cc:79: undefined reference to `DAQmxReadAnalogF64@36'
c:\Octave\Octave3.6.4_gcc4.6.2/AcqIntClk.cc:90: undefined reference to `DAQmxGetExtendedErrorInfo@8'
c:\Octave\Octave3.6.4_gcc4.6.2/AcqIntClk.cc:95: undefined reference to `DAQmxStopTask@4'
c:\Octave\Octave3.6.4_gcc4.6.2/AcqIntClk.cc:96: undefined reference to `DAQmxClearTask@4'
collect2: ld returned 1 exit status

 

I tried to copy all of the nidaqmx lib and include files I could find into the Octave lib and include folders.  The Extlib and include files and under C:\Program Files (x86)\National Instruments\Shared\CVI appear to be deficient. Can you please help?

0 Kudos
Message 3 of 4
(2,941 Views)

Update: I did find some more complete lib and include folders under

 

C:\Program Files (x86)\National Instruments\Shared\ExternalCompilerSupport\C

 

But when I copied them into my Octave (gcc) lib and include directories I still could not link (undefined reference to ....)

0 Kudos
Message 4 of 4
(2,937 Views)