Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to link VC++ and CVI

I have a VC++ application that uses CVI components. It links fine when VC++ is in debug mode, but when I change to Release mode I get link errors.

C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\mbstring.h(117) : error C2375: 'CVI__mbsbtype' : redefinition; different linkage
C:\Program Files\National Instruments\MeasurementStudio\CVI\include\mbsupp.h(73) : see declaration of 'CVI__mbsbtype'

I looked up the error on MSDN site and it means that a different linkage specified was being used such as static vs. extern.

VC++ uses the following -- CRTIMP int __cdecl _mbsbtype(const unsigned char *, size_t);

CVI uses the following -- int CVIANSI _mbsbtype(const unsigned char *, size_t);

I am including "toolbox.h" and <
afxwin.h> , ,
,

Any help would be greatly appreciated.

thanks,
Lorrie Smith
lorrie.smith@itt.com
0 Kudos
Message 1 of 4
(3,993 Views)
Hi Lorrie,

The VC++ compiler needs to know where the CVI include files are. I'm not sure if you have already done this, but when using CVI libraries, the project settings/C++ tab needs to have the following Additional Include Directories:

C:\Program Files\National Instruments\CVI\\include,
C:\Program Files\National Instruments\CVI\\instr,
C:\Program Files\National Instruments\CVI\\toolslib,
C:\Program Files\National Instruments\CVI\\toolslib\custctrl,
C:\Program Files\National Instruments\CVI\\toolslib\custctrl\custsupp,
C:\Program Files\National Instruments\CVI\\toolslib\localui,
C:\Program Files\National Instruments\CVI\\toolslib\printing,
C:\Program Files\National Instruments\CVI\\toolslib\reportgen,
C:\Program Files\National Instruments\CVI\\tools
lib\toolbox

Also, in the Project Settings (Link >> Input tab) you should have the following library modules listed:

"C:\Program Files\National Instruments\CVI\\extlib\analysis.lib"
"C:\Program Files\National Instruments\CVI\\extlib\cvi_lvrt.lib"
"C:\Program Files\National Instruments\CVI\\extlib\cviauto.lib"
"C:\Program Files\National Instruments\CVI\\extlib\cvisupp.lib"
"C:\Program Files\National Instruments\CVI\\extlib\cviwmain.lib"
"C:\Program Files\National Instruments\CVI\\extlib\dataskt.lib"
"C:\Program Files\National Instruments\CVI\\extlib\easyio.lib"
"C:\Program Files\National Instruments\CVI\\extlib\fpcustom.lib"
"C:\Program Files\National Instruments\CVI\\extlib\gpib.lib"
"C:\Program Files\National Instruments\CVI\\extlib\nivxi.lib"
"C:\Program Files\National Instruments\CVI\\extlib\visa.lib"
"C:\Program Files\National Instruments\CVI\\extlib\cvirt.lib"
kernel32.lib user32.lib gdi32.lib advapi32.lib

Note that this is an exhaustive
list and you might want to delete some files if you're only using toolbox functions.

Let me know if that doesn't solve the link error.

Regards,
Azucena
0 Kudos
Message 2 of 4
(3,993 Views)
What order are your #include statements in? The toolbox.h header file should be #include'd after the Windows header files. Also, take a look at toolbox.h - at the top of the header, it has:

#ifndef HAVE_CVI_RTE
#define HAVE_CVI_RTE 1
#endif

Then later in the file it has:

#if HAVE_CVI_RTE
#include
#else
#include
#include
/* ... */

mbsupp.h is the CVI header that defines the redefined _mbsbtype symbol and mbstring.h is the Visual C++ header that defines the _mbsbtype symbol. You could try adding a #define HAVE_CVI_RTE 0 statement before you include toolbox.h and that should only include the Windows header file that define _mbsbtype.

- Elton
0 Kudos
Message 3 of 4
(3,993 Views)
Thanks,

I tried adding the #define HAVE_CVI_RTE 0 statement as you suggested and it worked great!!

I'm forever in your debt.

Lorrie
0 Kudos
Message 4 of 4
(3,993 Views)