How to create a library project and use it in executable project
SEGGER Embedded Studio can not only be used to create executable projects but also library projects can be created. This article will show how a library project can be created in the same solution as an executable project and being used in the latter.
The setup guide will be based on the following software component:
- Embedded Studio V4.18 or later
The example project can be found here: SES_Library_Example
- Create a new executable project in a new solution for your target device
- Create a new library project in the same solution
- Add your library .c and .h files to the library project and build the library
- Use the library functions in your executable main application
- In Project Settings under Code->Build->Project Dependencies set the executable project to be dependent of the library project. This ensures that the library project will always be build before the executable project and that it will be linker properly.
- Build and run the executable application with your new library
Note: If you are simply looking to add a library to your project without project dependencies you can do so either via project option “Additional Input Files” or by adding the library to your project via drag & drop in project explorer.