Linking Errors in Third-Party Compiler with NI DAQmx

Updated Dec 28, 2023

Reported In

Software

  • LabWindows/CVI

Driver

  • NI-DAQmx

Programming Language

  • C
  • C++
  • C# .NET
  • Visual Basic .NET

Issue Details

​I want to build a C application with DAQmx in a third-party compiler, but I'm getting linking errors, or I want to use the DAQmx API in my text-based program, but I can't find the files I need. Where are the DAQmx libraries and headers located?

 

Solution

You can program and build C applications with NI libraries as long as you have the correct import libraries, headers, and directory paths to the .lib files added into your project before you compile.

The DAQmx DLL or .lib can be used with the DAQmx header for programming with the DAQmx API directly. Below are the file locations:
 
DAQmx DLL<WINDOWS>\system32\nicaiu.dll
DAQmx .lib (x86)<Program Files>\National Instruments\Shared\ExternalCompilerSupport\C\lib32\msvc\NIDAQmx.lib
DAQmx .lib (x64)<Program Files>\National Instruments\Shared\ExternalCompilerSupport\C\lib64\msvc\NIDAQmx.lib
Header<Program Files>\National Instruments\Shared\ExternalCompilerSupport\C\include\NIDAQmx.h

Additional Information

Linking errors can occur if you have installed the DAQmx driver but the support for ANSI C was not included in the install. You can modify your installation of DAQmx to include ANSI C support by following the steps in Location of ANSI C NI-DAQmx Shipping Examples and DAQmx Library File .

The DAQmx APIs include support for LabWindows/CVI, C, C++, Visual Basic 6.0, VB.NET and C#. For further information, please refer to Using NI-DAQmx in Text Based Programming Environments .

You will need to install the DAQmx driver on the development and target machines to be able to properly access the DAQmx API. Copying over the .dll, .lib, and .h files is insufficient, as the DAQmx driver references a host of other .dlls and files. The only way to ensure correct functionality is to install the full DAQmx driver, which can be downloaded from the NI website: Download NI-DAQmx Driver.

See the Related Links section below for information on how to find the reference documents/function help for the DAQmx API.