Keil Join the Personal library

Source: Internet
Author: User

Background: The code accumulated more, everyone may have tried to write a library, convenient to call, my initial approach is to put the usual functions into one. c file inside, to use when you put a. C added to the group inside, this method is very troublesome, each new project will add half a day.

Objective: To write some functions into the form of a library file, to the form of a header file function interface, so that other projects can be called directly.

1, the new 1 Keil project, wherein the. c file reads as follows:

#include "Hellowork.h"

U8 Hellowork (U8 A, U8 b)
{
return (A+B);
}

2. Set up 1. h files at the same time, the contents are as follows:

#ifndef _hellowork_h_
#define_HELLOWORK_H_
typedef unsigned char U8;
extern U8 Hellowork (U8 A, U8 b);

#endif

3, the entire project compilation options choose Create Library.

4, directly compile, generate personal library file hellowork.lib.

5. Add the runtime files to the project.

6, at the same time, also need to add the . h header file to the project, or the compilation will be error.

7. At this point, the new project will be able to invoke the function of the run-time library normally.

Keil Join the Personal library

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.