NI-DAQmx C Examples Not Running on Eclipse in Linux

Updated Aug 27, 2020

Issue Details

I have successfully installed DAQmx in my Linux (RHEL/centOS) system. I would like to run with Eclipse the C examples found in 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.