VXI and VME

cancel
Showing results for 
Search instead for 
Did you mean: 

Get LNK2005 error when use cvi.lib in windows application VC++

The typical error is:
libcmtd.lib(fflush.obj):error LNK2005 _fflush already defined in cvi.lib(cvirte.dll)

The errors do not occur in a console application.
0 Kudos
Message 1 of 4
(6,638 Views)
This looks like you are trying to define this fflush.obj file in your own library, when it appears that fflush is already defined in our own runtime library (cvirte.dll)
0 Kudos
Message 2 of 4
(6,638 Views)
The libcmtd.lib is not my own library. It is VC++ windows library. There are some conflicts between cvi.lib and MS libcmtd.lib. The errors do not occur in console application. I used nivxi.lib in my windows application but the linker gave errors of lnk2001 unresolved external symbols which I found in the cvi.lib. So I also used cvi.lib. Then the linker gave LNK2005.

My question is what libraries should I use to control vxi instruments in my VC++ windows application? In my application, I use functions such as initVXIlibrary(), closeVXIlibrary(), WScmd(), WSwrt(), VXIinReg(), etc.
Download All
0 Kudos
Message 3 of 4
(6,638 Views)
This my question and I'm going to answer it myself. The problem was I used the wrong version of nivxi.lib. The one I used and had problem is in the directory, my computer, C:\Program Files\National Instruments\MeasurementStudio\VXI\BIN\

There are two other libraries, nivxi.lib and nivxint.lib. The nivxi.lib is in C:\... \extlib\ and the nivxint.lib is in C:\Program Files\National Instruments\vxi\nivxi\api\win3\msc6\

Using either one of these two (WITHOUT using cvi.lib) will not give any errors.
Message 4 of 4
(6,638 Views)