Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Qt linker issues with NIDaqMX

Hi,

 

Very basic question but I couldn't find the solution after searching online for several hours.

 

I'm running NIDaqMX 14.1 in Windows 7 64-bit (although the NIDAQmx is installed in Program Files (x86)). I'm trying to interface with a PCIe-6353 with Qt Creator 3.4.2 (Based on Qt 5.5.0 (MSVC 2013, 32 bit). I included the nidaqmx.lib in the .pro file but I get LNK2019 messages for unresolved externals for all of the NI commands. The code and project file are below:

 

Does the NI library only work with mingw and not msvc?

 

 

#include <QCoreApplication>
#include "C:\Program Files (x86)\National Instruments\NI-DAQ\DAQmx ANSI C Dev\include\NIDAQmx.h"


int main(int argc, char *argv[])
{
    TaskHandle taskHandle;
    int error;
    // DAQmx analog voltage channel and timing parameters

    error = DAQmxCreateTask("", &taskHandle);
//    error = DAQmxCreateAOVoltageChan(taskHandle,"Dev3/ao0","",-10.0,10.0,DAQmx_Val_Volts,NULL);
    DAQmxStopTask(taskHandle);
    DAQmxClearTask(taskHandle);

    QCoreApplication a(argc, argv);
    return a.exec();
}

 

The .pro file is as follows

 

QT       += core

QT       -= gui

TARGET = untitled
CONFIG   += console
CONFIG   -= app_bundle
TEMPLATE = app
HEADERS += "C:\Program Files (x86)\National Instruments\NI-DAQ\DAQmx ANSI C Dev\include\NIDAQmx.h"
LIBS += "C:\Program Files (x86)\National Instruments\NI-DAQ\DAQmx ANSI C Dev\lib\msvc\NIDAQmx.lib"


SOURCES += main.cpp

 

 

 

 

 

 

 

 

 

 

 

 

 

0 Kudos
Message 1 of 6
(6,448 Views)

You can certainly compile code that uses the DAQmx DLL with MSVC---I do it all the time.

 

I think that library you're trying to link to is a 32-bit library.  Try using the following include and lib dirs:

 

C:/Program Files (x86)/National Instruments/Shared/ExternalCompilerSupport/C/include
C:/Program Files (x86)/National Instruments/Shared/ExternalCompilerSupport/C/lib64/msvc

 

HTH,

Adam

 

Message 2 of 6
(6,328 Views)

I am new to QT but am experiencing the same problem described in this thread.

 

The lib folder

C:\Program Files (x86)\National Instruments\Shared\ExternalCompilerSupport\C\lib32\msvc

contains only a lib file and no DLL.

 

where will my compiler find nidaqmx.dll

 

 

 

0 Kudos
Message 3 of 6
(5,851 Views)

Hi cpbandy, 

For future reference, I would recommend creating a new forum post so that your questions are not overlooked. 

Also, regarding your question, the DAQmx functions are in a static library(.lib) so the dynamic library of the fuctions (.dll) that you're looking for does not exist. 

Shalini M.
Partner Development Engineer
Alliance Partner Network
National Instruments
0 Kudos
Message 4 of 6
(5,804 Views)

Hi, 

i just linked int my QT project like this 

LIBS += -L$$PWD/'../../../../../Program Files (x86)/National Instruments/Shared/ExternalCompilerSupport/C/lib64/msvc/' -lNIDAQmx

and i don't have any error, but when i try to use a function 

DAQmxCreateTask("",&taskHandler);

 I have an error "undefined reference to 'DAQmxCreateTask'

Anybody can help me please ?

0 Kudos
Message 5 of 6
(2,091 Views)

I have the same problem, did you fix yours ? 

0 Kudos
Message 6 of 6
(2,090 Views)