From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Compilation problem using NIDAQmxBase C interface

When compiling my program using C functions for NIDAQmx, gcc returns this :


$ gcc -o AIPulseCounter SimpleCounter.c
/tmp/ccMybOXk.o(.text+0x2d): In function `main':
: undefined reference to `DAQmxBaseCreateTask'
/tmp/ccMybOXk.o(.text+0x74): In function `main':
: undefined reference to `DAQmxBaseCreateAIVoltageChan'
/tmp/ccMybOXk.o(.text+0xb1): In function `main':
: undefined reference to `DAQmxBaseCfgSampClkTiming'
/tmp/ccMybOXk.o(.text+0xbc): In function `main':
: undefined reference to `DAQmxBaseStartTask'
/tmp/ccMybOXk.o(.text+0xea): In function `main':
: undefined reference to `DAQmxBaseStopTask'
/tmp/ccMybOXk.o(.text+0xf5): In function `main':
: undefined reference to `DAQmxBaseClearTask'
collect2: ld a retourné 1 code d'état d'exécution


Any clues ?

Thank you.

Kevin

0 Kudos
Message 1 of 8
(3,906 Views)
Most likely problem is that you forgot



#include "NIDAQmxBase.h"



in your C source file. You will also have to make sure to set up search paths, or make sure NIDAQmxBase.h is in a location where gcc can find it.

Looking at your messages more closely, it looks like maybe they are coming from the linker. In that case, you need to link with the appropriate NI-DAQmx Base library. Since I work on Mac OS X and Windows, and it look like you are on a Linux machine, I can't help you much with that.

Message Edited by WM John Weeks on 07-18-2005 11:53 AM

John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 2 of 8
(3,901 Views)
Thank you,

It was a linking problem, as I am new to C, I was hoping including the .h was enough... silly me 🙂

Now, the program compiles, but when running, the following error is returned (I used the DAQmxErrCheck function presented in the examples)

DAQmxBase Error: DAQmx Base driver failed to initialized.

lsdaq detects my device nicely, but the same error is returned using LabView (Error -1)



0 Kudos
Message 3 of 8
(3,886 Views)
Well I think i'd better create a new post for this, as it is totally unrelated to thread topic..

0 Kudos
Message 4 of 8
(3,884 Views)
Hello Kevin,
 
Did you do a custom install of DAQmx Base?
 
Did you download LabVIEW after DAQmx Base? If you did, go into the installer in Add/Remove Programs in the Control Panel and add support for LabVIEW and C API.
 
If not, it sounds like you might have a corrupt driver. Uninstall DAQmx Base from Add/Remove Programs and reinstall it from ni.com. Please let me know if you have any questions or if that doesn't work. Have a great day!
 
Sincerely,
Marni S.
0 Kudos
Message 5 of 8
(3,868 Views)
Thank you, but, as I replied to my other post, a simple reboot solved the problem,

Moreover, I am using GNU/Linux, so LabWindows is not meant for me...

Regards,

Kevin.

0 Kudos
Message 6 of 8
(3,860 Views)
how did you resolved the linking problem? I have the same problem, I tryed to explicit the compilation but no work... 😞     
Thanks!

-TiRo-
0 Kudos
Message 7 of 8
(3,804 Views)

Hi 

 

Is there any example of how to link the liberary. I am trying to do it in QT and failing 😞

0 Kudos
Message 8 of 8
(3,138 Views)