Can I Use the MFC Library as a Statically Linked Library With a Measurement Studio Project in Visual C++?Primary Software: Measurement Studio>>Visual C++ SupportPrimary Software Version: 6.0 Primary Software Fixed Version: N/A Secondary Software: N/A
Problem: I used the Microsoft Foundation Classes (MFC) AppWizard to create a Measurement Studio 6.0 project, and I selected the option to use the MFC as a statically linked library. I was able to create the project, but when I built the project the following error was generated: Common UI component does not support linking to static MFC. Now I cannot run the application. Can I build a Measurement Studio project using the MFC library as a statically linked library? Solution: Your application includes a Measurement Studio User Interface component or 3D Graph component. These components contain ActiveX controls that link to the MFC DLL. It is not valid to link to both static MFC and the MFC DLL in an application. You therefore cannot link to static MFC in an application that uses the User Interface component or 3D Graph component. When using the User Interface or 3D Graph component, select As a shared DLL (refer to the attached image below of the NI Measurement Studio AppWizard dialog box.) Alternatively, in previous versions of Measurement Studio, the Measurement Studio AppWizard added the mfcs42.lib and mfcs42d.lib files to projects to work around the linker limitation discussed in Microsoft's knowledge base article, Q148652. Projects that are statically linked to MFC do not use these library files and thus, produce linker errors upon compiling when the library files are included. To prevent these linker errors, you must remove mfcs42.lib and mfcs42d.lib from your project. Complete the steps below to remove the files.
Note: If you are using a C module in your project, refer to KnowledgeBase 35SD8G00 for information about how to handle using C source files while linking to MFC.
Related Links: Microsoft KB#Q148652. PRB: LNK2005 Errors When Link C Run-Time Libraries Are Linked Before MFC Libraries KnowledgeBase 35SD8G00: Linker Errors when Compiling with C-based Instrument Drivers Attachments:
Report Date: 04/16/2003 Last Updated: 11/12/2008 Document ID: 2WFDHR8O |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

