05-23-2011 08:40 PM
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.
Solved! Go to Solution.
05-23-2011 08:51 PM
By the way, I should mention I'm including either the "gpib.h" or "ni4882.h" header file. The error is the same.
05-24-2011 02:25 PM
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.
05-24-2011 04:22 PM
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.
05-25-2011 01:35 AM
Hello,
just as a side note, CVI is not a C++ compiler, so may be this forum is not the most appropriate one
05-25-2011 10:44 AM
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.
05-25-2011 12:15 PM
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
05-25-2011 05:26 PM
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.