Accessing NI-VISA from Qt C++ 4.7 <p>I am developing a Windows (7) application using Qt (4.7.0) to call some methods in a DLL (NI visa32.dll) to communicate with instruments through the GPIB port. The manufacturer's header file is also available (visa.h).</p> <p>In the project file, I tried adding the path and library reference to the original places where the files are located at as:</p> <pre><code>INCLUDEPATH += "C:/Program Files/National Instruments/Shared/CVI/Include" LIBS += "C:/Windows/System32/visa32.dll" </code></pre> <p>but, I get the compilation error:</p> <pre><code>collect2: ld returned 1 exit status </code></pre> <p>Following the instructions in <a href="http://stackoverflow.com/questions/2590299/importing-dll-into-qt">Importing a DLL into Qt</a>, I created a "visa.a" from the "visa32.dll", and copied them to a subfolder "visa/lib", and added the path and library to the project file:</p> <pre><code>INCLUDEPATH += visa/include LIBS += -Lvisa/lib LIBS += -lvisa.a </code></pre> <p>I tried also with <code>-lvisa</code> or <code>-lvisa.dll</code>, but in all the cases I get also another compilation error saying that the <code>-lvisa</code>, <code>-lvisa.a</code> or <code>-lvisa.dll</code> is not found. I edited the original header file "visa.h", and prefixed with Q_DECL_IMPORT every object in the file, and also made sure that the extern "C" statement be present.</p> <p>I include the reference to the header file in the application as:</p> <pre><code>#include "visa.h" </code></pre> <p>and note that the compiler does recognize the referenced objects belonging to the visa.h file.</p> <p>Any help to solve this compilation error will be greatly appreciated.</p> <hr> <p>I also tried with Visual C++ (2010) following the instructions of <a href="http://stackoverflow.com/questions/809948/dll-references-in-visual-c">DLL References in Visual C++</a>. In this case, I do not get any compilation error, but linking errors. For example: </p> <pre><code>AgiE364X.obj: error LNK2019: unresolved external symbol "extern "C" long __stdcall viClose(unsigned long)" </code></pre> <p>being viClose a called method in NI-VISA. </p> <p>I would prefer to use Qt C++ instead of Visual C++, though. </p> <p>Thanks in advance.</p>