Difference between revisions of "How to create a library project and use it in executable project"

From SEGGER Wiki
Jump to: navigation, search
(Setup Guide)
(Setup Guide)
 
(One intermediate revision by the same user not shown)
Line 12: Line 12:
 
# Add your library .c and .h files to the library project and build the library
 
# Add your library .c and .h files to the library project and build the library
 
# Use the library functions in your executable main application
 
# 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.
+
# 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 linked properly.
 
# Build and run the executable application with your new library
 
# 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.
+
'''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.
   
 
[[Category:Embedded Studio]]
 
[[Category:Embedded Studio]]

Latest revision as of 14:40, 1 August 2022

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.

Example Setup

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

Setup Guide

  1. Create a new executable project in a new solution for your target device
  2. Create a new library project in the same solution
  3. Add your library .c and .h files to the library project and build the library
  4. Use the library functions in your executable main application
  5. 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 linked properly.
  6. 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.