Archived:NI-DAQmx C Examples Not Running on Eclipse in Linux

Updated Jun 1, 2023

NI does not actively maintain this document.

This content provides support for older products and technology, so you may notice outdated links or obsolete information about operating systems or other relevant products.

Issue Details

For New Projects, a Modernized Toolchain Is Advised Instead

This article explains how to use Eclipse C/C++ Development Tools for NI Linux Real-Time to achieve cross-compiling tasks. This toolset is not actively maintained anymore. It was last updated in 2018 and is currently not advised to be used for new projects.

Instead, NI created extensive documentation for a modernized toolchain, which is easier to learn and utilize. That documentation also provides information on typical steps, like building, deploying, and debugging a shared library. If you are planning to do C/C++ development and are searching for the right toolchain, then visit Getting Started with C/C++ Development for NI Linux Real-Time.
 

Overview of the Following Eclipse-Based Content

I have successfully installed DAQmx in my Linux (RHEL/centOS) system. I would like to run with Eclipse the C examples included with the NI Linux Device Drivers (July 2018) page. However, the compiler cannot find the DAQmx functions and compilation fails. 

Solution

In order to indicate to the compiler to search for the DAQmx functions, you will have to make some modifications, i.e., specify the name of the shared libraries to the GCC linker as explained below:
 
1.        In Eclipse, right-click on the project, then select Properties
2.        Go under C/C++ Build >> Settings
3.        Select GCC C Linker  >> Libraries
4.        In Libraries (-l), add the name of your libraries: nidaqmx
5.        Put the directory where your libraries are hosted in Library search path (-L): /usr/lib/x86_64-linux-gnu

You can check the following image as reference:



After doing the steps above, you should be able to successfully run the C examples.