HOWTO: Create a Static Library with Visual WorkbenchLast reviewed: September 30, 1997Article ID: Q102677 |
The information in this article applies to:
SUMMARYWhen you build a static library (.LIB file) with Visual Workbench, the default project options build a static library for the Microsoft Windows operating system. The documentation does not explicitly indicate this fact. By default, the 16-bit versions of Visual Workbench listed above specify the /GA compiler option switch when they build a static library, and the 32- bit development environment includes the /D "_WINDOWS" compiler option switch. Each of these options defines the _WINDOWS symbol for all source files in the project. To build a static library for the MS-DOS operating system with 16-bit Visual Workbench or a console static library with the 32-bit development environment, follow the appropriate steps listed below:
Building a Static Library for MS-DOS with 16-bit Visual WorkbenchWhen you build a static library for MS-DOS, you must remove the /GA compiler option switch. To do so, choose Project from the Visual Workbench Options menu, then choose the Compiler button. Select the Windows Prolog/Epilog category and choose the None option in the "Generate Prolog/Epilog For" box. Then choose OK to change the project options. NOTE: Removing the /GA leaves no preprocessor definition for the target platform. Specifically, removing /GA also removes /D "_WINDOWS", since /D "_WINDOWS" is forced by /GA. If you remove /GA, you also need to add /D "_DOS", or else compilation errors will occur in the preprocessing of standard headers, such as AFX.H.
Building a Console Static Library with Visual Workbench 1.1When you build a console library, you must remove the /D "_WINDOWS" option from the list of compiler options. To do so, choose Project from the Visual Workbench Options menu, then choose the Compiler button. Select the Preprocessor category and remove the string _WINDOWS from the "Symbols and Macros to Define" edit control. Then choose OK to change the project options.
Building a Console Static Library with Visual Workbench 2.x and 4.0When you build a console library, you must remove the /D"_WINDOWS" option from the list of compiler options. To do so with the Visual WorkBench version 4.0, choose Settings... from the Build menu; to do do with the Visual WorkBench version 2.x, choose Settings from the Project menu. For both versions, choose the C/C++ tab. In the Visual WorkBench version 4.0, select the General category; in the Visual WorkBench version 4.0, select the Preprocessor category. For both versions, remove the string _WINDOWS from the "Preprocessor Definitions" edit control. Choose OK to save the new project options. NOTE: 32-bit Import libraries are created by LINK when it builds a program or DLL that contains exports. 16-bit Import libraries are build using IMPLIB. Keywords : VwbIss kbfasttip Version : WINDOWS:1.0,1.1,1.5,1.51,1.52;WINDOWS NT:1.0,2.0,2.1,4.0,5.0 Platform : NT WINDOWS Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |