Generate a. Lib file for a single c file under the Keil realview MDK

Source: Internet
Author: User

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/

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.