Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I compile DAQmx7.5 programs with DevC++?

Hi,

we are beginning to acquire measurements with NI-USB6009 DAQ and we installed NIDAQmx7.5 libraries to exploit its advanced features. But when we compile with Dev C++ the example files we have  linker errors such as    " [Linker error] undefined reference to `DAQmxCreateTask@8' ", for every DAQmx function we call.
For the NIDAQmxBase these errors didn't occur. How can we solve this problem using Dev C++?

Thanks for your help,
Marco
0 Kudos
Message 1 of 10
(5,453 Views)
Make sure you are linking with NIDAQmx.lib. You will find it in

Program Files\National Instruments\DAQmx ANSI C Dev\lib\msvc\
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 2 of 10
(5,438 Views)
Yes I compile with NIDAQmx.lib, and import libraries and include files. I think the problem is with the Dev C++ compiler itself.

Message Edited by superfrenkie on 08-30-2005 11:58 AM

0 Kudos
Message 3 of 10
(5,432 Views)
Oh. I'm using VC++.net with success. I'm building a DLL using standard C++. Are you using anything special like managed code? (I'm quickly getting out of my depth here)

The "@8" on the end looks like a mangled name of some sort. You may need to do something to turn off the mangling.
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 4 of 10
(5,424 Views)
Hi,
the true point of the issue is that DevC++ is probably not completely supported. This is basically why you are getting linking errors to 'DAQmxCreateTask@8' and others probably. The final @8 reports the size of the parameters the function is expecting or something similar.
Anyways, I suggest you take a look at JoeSavage's approach on this web page .
He basically posted a Wrapper DAQmx C code that can be included in your C code and resolve the names the linker is missing.
 
AlessioD
0 Kudos
Message 5 of 10
(5,416 Views)
I tried to compile NIDAQmx.c inside my project as the post's author suggests but the compiler returns this error '' invalid conversion from `void*' to `int32 (*)(const char*, TaskHandle*)'  '' for this line of code '' if (!(DAQmxLoadTask_Ptr = (void*) GetProcAddress(DLLHandle, "DAQmxLoadTask")))  ''. This is repeated for a lot of similar instances and I don't know how to fix it. Perhaps the whole procedure is incorrect, should I compile NIDAQmx.c in another directory?

Thanks a lot, Marco.

0 Kudos
Message 6 of 10
(5,415 Views)
Hi,

we tried to overcome the problem using the Visual C++ command line compiler. The compiling and linking are ok (for example we tried with the ContAcq-IntClk.cpp file  from NI) but  if we run the program we have the following error

DAQmx Error: Device identifier is invalid.
Device Specified: Dev1

Task Name: _unnamedTask<0>

Status Code: -200220
End of program, press Enter key to quit

What could be the cause in your opinion? OurDAQ is the USB6009. Thanks a lot,
Marco
 
0 Kudos
Message 7 of 10
(5,403 Views)
the USB-6008 device needs to be recognized by NI_DAQ 7.5 under MAX. You need to follow the indications reported on this KnwoledgeBase  in order for the Device to be assigned a correct identifier. AlessioD
0 Kudos
Message 8 of 10
(5,400 Views)
Great!

thanks for your suggest, everything seems to work fine, the problem was to switch the device between NIDAQmxBase and NIDAQmx. Now we can choose to work with DevC++ or command-line VisualC++...

Marco.
0 Kudos
Message 9 of 10
(5,397 Views)
If you're compiling this as C++, you can't automatically convert a void * to other types. I'm not sure about function pointers and C; I thought with standard C this would be OK. You will have to cast the return value of GetProcAddress to the actual function pointer type, like this:

typedef int32 (* LoadTaskFuncP)(const char*, TaskHandle*);
DAQmxLoadTask_Ptr = (LoadTaskFuncP)(GetProcAddress...

or, using more modern C++

DAQmxLoadTask_Ptr = reinterpret_cast(GetProcAddress...

The typedef is just to make it more readable. I haven't compiled this, so take warning...
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 10 of 10
(5,386 Views)