Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

I have problem using MFC static library

I'm developping with VC++ 6.0 integrated by measurement studio 6.0. I need to use MFC Static Library but the compiler return the following error:
c:\programmi\national instruments\measurementstudio\vc\include\niuicommoncomponent.h(25) : fatal error C1189: #error : Common UI component does not support linking to static MFC.
Error executing cl.exe.

Why??? Measurement studio 6.0 doesn't support static link library???
0 Kudos
Message 1 of 6
(4,813 Views)
In general, Measurement Studio does provide support for linking to static MFC, but not for the UI or 3D Graph components. The reason why is that the UI components are custom C++ interfaces to ActiveX controls and the ActiveX controls dynamically link to the MFC dll, so your application would still indirectly have a dynamic link to MFC even though you were statically linking to MFC.

- Elton
Message 2 of 6
(4,813 Views)
Thanks, I understand but... now what can I do? The following is my situation:
I'm developping an MFC application that use 3 static library (build in my company) and the CWGraph component of Measurement Studio.
In my company there are Visual C++ 6.0, Visual C++ 7.0 (in Visual Studio .NET 2003) and Measurement Studio 6.0.
Have you any solution?
Thanks in advance
Alessio
0 Kudos
Message 3 of 6
(4,813 Views)
Do the static libraries link to static MFC? If not, there shouldn't be a problem. The Measurement Studio libraries are also static libraries, but Measurement Studio provides both libraries that link to static MFC and libraries that link to the MFC dll. The error that you're seeing is because you're trying to link to static MFC, hence it's pulling in the Measurement Studio UI libraries that link to static MFC. If the other static libraries that you're using either link to static MFC or don't link to MFC at all, you should be able to link to the MFC dll for the Measurement Studio libraries with no problems.

- Elton
0 Kudos
Message 4 of 6
(4,813 Views)
My static library link to static MFC library. If I compile my application with MFC static library, it returns the following error:
"c:\programmi\national instruments\measurementstudio\vc\include\niuicommoncomponent.h(25) : fatal error C1189: #error : Common UI component does not support linking to static MFC.
Error executing cl.exe."
If I compile with MFC shared DLL, the application returns about 220 errors. For example one of them:
"nafxcwd.lib(strex.obj) : error LNK2005: "class CString __stdcall operator+(class CString const &,char)" (??H@YG?AVCString@@ABV0@D@Z) already defined in mfc42d.lib(MFC42D.DLL)"

So, I don't know how to resolve this problem.

Alessio
0 Kudos
Message 5 of 6
(4,813 Views)
Thanks of all, I have just resolved my problem. I have changed my static library in shared dll and now my application compiled successfully

thanks again for your support
Alessio
0 Kudos
Message 6 of 6
(4,813 Views)