User manual

Chapter 2 Fundamentals of Building Windows Applications
© National Instruments Corporation 2-7 NI-DAQ User Manual for PC Compatibles
Creating a Windows Application Using Borland C++
This section assumes that you will be using the Borland C++ 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 Borland 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
)
for GUI applications.
3. Specify the directory that contains the NI-DAQ header and import
library files under the source directories (Include, Libary) settings
of your compiler. For Borland C++ 5.0, this directory is under
Options»Projects»Directories. The NI-DAQ header files are located
in the
.\Include
directory under your NI-DAQ directory, and the
import library files are located in the
.\Lib
directory under your
NI-DAQ directory.
4. Add the NI-DAQ import library,
nidaq32.lib
, to the project.
5. Build your application.
Example Programs
You can find some example programs and project files in
.\Examples\BorlandC
directory under your NI-DAQ directory.
To build an example program, run one of the batch files with the.bat
extension from a DOS prompt. You will have to modify the batch file to
set one of the environmental variables to point to your Borland C++ IDE
directory. If you open one of the batch files with a text editor, you will see
the following line:
set BorlandDir=e:\apps\bc5