One: Creation of a static library
- The new one in vc++6.0 is the Win32 Static Library project, followed by two options. Choose it according to your needs.
- The process of adding a specific class or function is like a standard project, creating a new class directly or adding a new
. h (Example: MY.h) and. CPP (example: MY.cpp) files. Then write the implementation in it.
- When finished, the compilation generates a. lib file (for example: MY.lib generated) The file I generated is TEST.lib .
Compile a problem, remove a long
- Prompt for error modification methods
II: Creation of dynamic libraries
- vc++6.0 in the new one for the Win32 Dynamic-link Library project, followed by three options. Choose it according to your needs.
- The process of adding a specific class or function is like a standard project, creating a new class directly or adding a new
. h (Example: MY.h) and. CPP (example: MY.cpp) files. Then write the implementation in it.
- When finished, the compilation generates a. lib file (for example, MY.lib is generated).
Third: Static library use
Static libraries include. Lib and. h files
1, in the project to add a static library, there are two ways:
method One : Referenced in the project settings. Lib,project-setting-link-object/library Modules Tim
Add. lib; (need to set the correct reference path in tools/options)
method Two : Join Lib,project-add to Project-files directly in the project and select the correct. lib.
Issue 1: Link error after changing settings so
Method:
Join #pragma comment (lib, "MYTEST.lib")
Copy the two files to the appropriate folder in Use1.cpp and you are ready to run.
2. Include. h files in the project (you may need to set the correct reference path in tools/options)
3, the use of static library functions in the project;
Four: Dynamic library use
Dynamic link libraries typically include. Lib (export function),. H,.dll.
1, implicit links, similar to the use of static library, divided into three steps: Reference. lib, including the header file, using the export function;
2, dynamic loading, directly using LoadLibrary load the required dynamic library, and then specify the required export function, the effect
Rate is highest!
3. Compile link pass, run failed
Found the creation method is incorrect, modify the code as follows
Copy the MYTEST3.dll to debug and successfully
Study reference: http://wenku.baidu.com/view/47507393daef5ef7ba0d3ca6.html
Http://www.docin.com/p-65088206.html
Make a static library and a dynamic library under Windows