LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Including gpib.lib and nidaqmx.lib causes multiple defined signals

Solved!
Go to solution

Hi,

 

I'm trying to create a program that uses NIDAQmx functions and GPIB functions.  To do so, I link to both nidaqmx.lib and gpib.lib from NI.  However, when trying to build my project in VC++ 2005, I get the following error:  

 

gpib.lib(gpbint32.obj) : error LNK2005: ___RunStateChangeCallback already defined in nidaqmx.lib(NIDAQmx_CG.obj)

fatal error LNK1169: one or more multiply defined symbols found

 

Is there a way to fix this?

 

Thanks.  

0 Kudos
Message 1 of 8
(3,468 Views)

By the way, I should mention I'm including either the "gpib.h" or "ni4882.h" header file.  The error is the same.  

0 Kudos
Message 2 of 8
(3,467 Views)

Greetings, I was looking into this issue and found something that looks like it could be pertinent to your issue. At the very least it has the same two errors your application is producing. 

 

http://zone.ni.com/devzone/cda/tut/p/id/12743

 

"If you have created a Visual C++ Console Application and are linking statically to MFC, you may encounter LNK2005 and LNK1169 errors.
This problem happens when MFC static libraries and CRT static libraries link in the wrong order. To correct this problem, ensure that the #include <afx.h> statement is the first include statement in the generated stdafx.h header file. For more information, refer to Microsoft Knowledge Base Article 148652."

 

Hopefully that helps.

Product Support Engineer
National Instruments
0 Kudos
Message 3 of 8
(3,452 Views)

Hello,

 

Thank you for the response.  Unfortunately, including the library dependencies in a different order still results in the same error.  Furthermore, I am not developing a console application for Win32; my project is a generic C++ project.  nidaqmx.lib and gpib.lib both define ___RunStateChangeCallback. Surely both of these libraries should be usable in the same program.  I must be missing something.  

 

I am using nidaqmx.lib from C:\Program Files\National Instruments\Shared\CVI\Extlib\msvc

I am using gpib.lib from C:\Program Files\National Instruments\CVI90\extlib\msvc

 

Both of these libraries must be used in my program.  

0 Kudos
Message 4 of 8
(3,447 Views)

Hello,

 

just as a side note, CVI is not a C++ compiler, so may be this forum is not the most appropriate one Smiley Wink

0 Kudos
Message 5 of 8
(3,443 Views)

I understand that CVI is not a compiler.  However, both of these libraries, nidaqmx.lib and gpib.lib, have the same function defined in each library.  This will cause a problem no matter what compiler is used.  Surely, someone has used DAQmx and GPIB in the same project before and has some input.  

0 Kudos
Message 6 of 8
(3,431 Views)
Solution
Accepted by topic author Djaunl

Hello -

 

It looks like there is an issue with the CVI 9.0 version of gpib.lib.  The lib in the extlib location should not include that symbol, and this has been resolved in CVI 2009.  I have attached the CVI 2009 version of the lib to this post - it should resolve your issues.  Please let me know if it does not.

 

NickB

National Instruments

Message 7 of 8
(3,426 Views)

NickB,

 

Thank you for the library download.  I included this one in my project instead of the library from CVI 9.0 and it indeed works.  There are no multiply defined symbols, and my GPIB program runs fine.  

 

Again, my thanks.  

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