Original article http://blog.csdn.net/gasbi/article/details/6761420
I checked this question one afternoon and didn't even have a complete web page to explain it clearly. Isn't it too simple for everyone to say? In most cases, the project is simply converted to. Lib. Under Project-> options for target-> output, select create library.
However, the generated lib file is huge. The final lib generated by the project I compile now has 2.6 MB.
Later I found inspiration (http://www.keil.com/support/docs/2610.htm) from the official Keil website in English ):
1. Right-click the project, assume it is A, select Add group, assume it is B, then add the file that wants to generate lib to B group, and assume the file is CC. c. CC is required. h.
2. Right-click another group and remove the include in target build check box under options for group> properties according to the information on the official Keil website, in this way, the Lib will not be compiled.
3. Under Project-> options for target-> output, select create library and change the output file name to CC. Click OK.
4. Compile, so that the generated cc. lib can be found in the OBJ in the project folder. I only put one function in it, and the size is 80 KB.
5. Pay attention to calling the CC. copy lib to the source folder, add it to the main group, and delete the previous CC. c. Use CC. ensure that the C file contains "cc. H ". Of course, before writing cc. C, you must also include "cc. H" and declare the functions in CC. c In cc. h. Finally, we need to restore, compile, and OK all the items that have been removed!
Reference URL:
Generate and call lib library files in Keil C
Http://blog.ednchina.com/alexi2008/224810/message.aspx
Micro vision: Create library and application in one project
Http://www.keil.com/support/docs/2610.htm
Generate a personal summary of the Keil lib
Http://blog.21ic.com/user1/3742/archives/2010/70337.html
Encapsulation of Keil lib library functions
Http://blog.csdn.net/CaesarZou/article/details/5533934
How to use the self-generated lib library in Keil
Http://blog.csdn.net/wgq2633/article/details/2897752
Keil generates lib and calls lib
Http://dufanfance.blog.163.com/blog/static/144959439201151414974/