Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Turbo C comiler Errors with NIDAQmx.h

I am using Turbo C to write read the Analog channels of PCI-6052E card . I have included the NIDAmx.h so that i can use the functions of h file ,but when i compile the code lot of errors nealy 26 appear like "Expected , " in nidaqmx.h etc...              is there any thing more to include or any library ?
first line of code is like this
 
#include<nidaqmx.h>
#include<math.h>
#include <iostream.h>
 
main()
{
statement 1;
statemnet 2;
....
 
}
 
 
0 Kudos
Message 1 of 7
(4,766 Views)

Hi Haider:

What I’m going to point you to is to the “ANSI C” examples that are install with the NI-DAQmx drivers. Location of ANSI C NI-DAQmx Shipping Examples and DAQmx Library File is the knowledge base in case you can’t find them; take a closer look at "Acq-IntClk.c" it might be what you are looking for.  Make sure you have a space between include and the <library> since you just wrote include<library> I don’t remember if “Turbo C” highlights the text for syntaz errors. But you are correct, the only thing you need to include in you code is: #include <NIDAQmx.h>,

Jaime Hoffiz
National Instruments
Product Expert
Message 2 of 7
(4,748 Views)
Sir,
your didnt specified the versions of NIDAQmx that support Turbo C/C++
I am using NIDAQmx 8.6 , header "nidaqmx.h"
but it generates errors in header at the begining.
like "Redefinition of ....."
 
0 Kudos
Message 3 of 7
(4,741 Views)

Hi Haider,

Since you are using NI DAQmx 8.6 which is the most current version of the driver, you should not have a compatibility problem with Turbo C/C++.   As Jaime mentioned, you should use the line #include <NIDAQmx.h>. However, to make sure that you are accessing the correct header file, try including the direct path to the file.  On my computer,  I would include the following:

#include <”C:\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\include\NIDAQmx.h”>

Jaime also suggested using the example programs that come with the ANSI C environment and DAQmx.  If you can run the example with the DAQmx include statement, we will know that there is a syntax error in the way you are adding your header files.  From there, you can copy over the exact syntax used in the example into your own program.

Redefinition errors sometimes occur due to defining functions more than once.  The header file includes function definitions. Therefore, if you are defining a function in your program with a similar name to one in the header file, these errors could occur.  Please let me know if these suggestions help!

Regards,
Vanessa L.
Applications Engineer
National Instruments
Message 4 of 7
(4,706 Views)
I am just adding the include file not calling any function ? even then there are lot of errors
syntax errors, Redefinition errors
 
0 Kudos
Message 5 of 7
(4,690 Views)
Hi Haider-
 
Can you provide a list of the types that are running into redefinition errors?  If you look at the NIDAQmx.h file you will see that several common numeric types (int8, int16) are defined with names that might collide with something else that TurboC is trying to compile into the mix. 
 
If so, you could just comment those definitions from the NIDAQmx.h file (although it would be good to first verify that the TurboC definitions are the same types and widths to avoid any problems with DAQmx functionality).
 
Hopefully this helps-
Tom W
National Instruments
0 Kudos
Message 6 of 7
(4,667 Views)
I take it you are using the borland version of the MX lib file and not the microsoft one.
Also you will  get this error if you include the same header more that once.
Why not upgrade to something new like Visual Studio .NET
You could use the free C# Express version and dump Turbo C as it is years out of date.
VS C++ Express will compile native code that does not use .Net, also free from Microsoft. 
 
Colin 
0 Kudos
Message 7 of 7
(4,652 Views)