DAQmx ANSI C Example with Visual C++ the NIDAQmx.h Header Can Not Be Found

Updated Jan 6, 2018

Reported In

Driver

  • NI-DAQmx

Programming Language

  • C
  • C++

Issue Details

I am trying to compile a DAQmx ANSI C example with Visual C++ and I receive the following error:
fatal error C1083: Cannot open include file: 'NIDAQmx.h': No such file or directory.

How can I specify the location of this header file?

Solution

In most cases one uses the following syntax to include header files into C/C++ code:

#include "NIDAQmx.h"

This syntax does not specify the location of the header file. Therefore, Visual C++ will look for the file in the default include file directories. If the file is not in any of these folders an error will be thrown.

The first way to solve this problem is to specify the exact location of the header file in your C file by using the following syntax:

#include "<Program Files>\National Instruments\Shared\ExternalCompilerSupport\C\include\NIDAQmx.h"


The second, and more elegant, way to point Visual C++ to the location of your source file is to add its directory to the list of default include directories. The following steps add a directory to the list of default directories.

Visual C++ 6.0
1. Click on Tools in the toolbar and select Options...
2. Click on the Directories tab
3. Select Win32 for the Platform: combo box and Include files for the Show directories for: combo box
4. Click the New button and select the directory containing the required header file
5. Click the OK button to save your changes and close the window

Visual C++ .Net
1. Click on Project in the toolbar and select [Project Name] Properties...
2. Select Configuration Properties » C/C++ » General
3. Click in the Additional Include Directories property textbox and select the directory containing the required header file
4. Click the OK button to save your changes and close the window

WAS THIS ARTICLE HELPFUL?

Not Helpful