C++ learning-VS 2019 production and use of C++ dynamic library steps

From the previous article, https://blog.csdn.net/JACKSONMHLK/article/details/111936325

For the remaining problems, make a solution here, and then add a solution later.

1. How to make a dynamic library and a static library.

Although vs provides a direct environment for dynamic libraries and static libraries, I don't know how to use them, so I used empty projects to create dynamic and static libraries.

@1. First, create an empty project, then right-click the project name, where han.h is the declaration of the class and han.cpp is the specific implementation of the class. If you just try it first, you can make a simple function yourself and try Try the process.

@2. Make the following selections on the attributes.

@3. Finally, compile and run, and the library will be generated under the debug of the file you created.

Among them, I don’t know if it’s a problem with my environment or what is the reason. When I generate a dynamic library, I can’t directly generate a static library and a dynamic library, so my husband became a static library, and then re-selected to compile and run, and then generate the dynamic library. .

2. How to use dynamic libraries.

@1 Copy the dynamic library, static library, and header files to the directory of your newly created file,

@2. Then in the **resource file**, add the static library, and then you can directly use the functions used in the header file in your newly created file.

@3, we can see that the header file is directly quoted, no error is reported, and it can run correctly

 

 

 

If the big guys have problems, give them advice and exchanges.

Guess you like

Origin blog.csdn.net/JACKSONMHLK/article/details/112882333