User manual
Chapter 2 Fundamentals of Building Windows Applications
NI-DAQ User Manual for PC Compatibles 2-2 ni.com
Creating a Windows Application Using
Microsoft Visual C++
This section assumes that you will be using the Microsoft Visual C++
Integrated Development Environment (IDE) to manage your code
development, and that you are familiar with the IDE.
Developing an NI-DAQ Application
To develop an NI-DAQ application, follow these general steps:
1. Open an existing or new Visual C++ project to manage your
application code.
2. Create files of type
.c
(C source code) or
.cpp
(C++ source code)
and add them to the project. Make sure you include the NI-DAQ
header file,
nidaq.h
, as such in your source code files:
#include "nidaq.h"
You may also want to include
nidaqcns.h
and
nidaqerr.h
.
Optionally, you can include other files (for example,
.rc, .def
) that
you have created for graphical user interface (GUI) applications.
3. Specify the directory which contains the NI-DAQ header files under
the preprocessor»include directory settings in your compiler. (For
Visual C++ 4.X, this is under Build»Settings»C/C++. For Visual C++
5.0/6.0, this is under Project»Settings»C/C++.) The NI-DAQ header
files are located in the
.\Include
directory under your NI-DAQ
directory.
4. Add the NI-DAQ import library
nidaq32.lib
to the project. The
NI-DAQ import library files are located in the
.\Lib
directory under
your NI-DAQ directory.
5. Build your application.
Example Programs
You can find some example programs and project files in
.\Examples\VisualC
directory under your NI-DAQ directory.
To load an example program, use one of the generic makefiles with
the
.mak
extension.
To load an example project with Visual C++ 4.X or later, select the menu
option File»Open Project Workspace, and select List Files of Type to be
Makefiles. Then select the
.mak
file of your choice.










