Mistake on this page? Email us

Managing libraries

When you import a program to Mbed Studio from os.mbed.com, a Git hosting service or one of the built-in example programs, you also import all of the libraries on which it is dependent, including mbed-os. You can import additional libraries to your program in order to make use of their functionality.

A library - which Mbed Studio represents with a cog icon - is associated with a specific program in your workspace. If you have multiple programs that use a particular library, you will have multiple copies of the same library; one per program. Each copy of the library can be at a different commit, and updating a library for one program does not update other copies of that library.

Opening the Libraries tab

The Libraries tab lists all of the libraries in an active program. From this tab you can view library details - such as the library version and where it was imported from - and import, remove, and update a library, or check out a specific library version.

To open the Libraries tab:

  1. Right-click the program name in the files pane and select Set Active Program.

  2. Select Libraries from the View menu.

    The Libraries tab opens in the bottom panel.

When a library is dependent on another library, the Libraries tab presents the dependency indented under the dependent library.

Importing a library

You can import libraries to an existing program from os.mbed.com or from a Git hosting service. Each library that you add to a program is identified by a .lib file.

Note: The Mbed Studio files pane hides .lib files.

To import a library:

  1. Click the Add new library button () on the Libraries tab.

    This opens the Add Mbed Library window.

  2. Choose whether you want to import the library from os.mbed.com or from a Git hosting service and paste the full remote URL.

  3. Modify the library name as required, and click Next.

  4. Specify the branch or tag you want to import.

  5. Click Finish.

You can view the progress of the import on the Background Tasks progress indicator, which appears at the bottom right corner of the screen. When the import is complete, the library appears on the Libraries tab and in the files pane.

Removing a library

To remove a library:

  1. Click the Remove library button (), which appears on the right when you hover the mouse pointer over library name on the Libraries tab.

    The Remove library window is displayed.

  2. Click Remove.

Updating a library or checking out a specific library version

When you import a library to Mbed Studio from os.mbed.com or from a Git hosting service (either manually, as described above, or as a dependency for an imported program), you clone the library to your workspace.

When there are updates to libraries in an active program, the Update all button at the top right corner of the Libraries tab indicates the number of updates available. Click the Update all button to view details about the available updates.

You can update all of the top-level libraries in the active program in one click, or update or check out a specific version of each library individually.

To update all top-level libraries in a program:

  1. Click the Update all button () at the top right corner of the Libraries tab.

    The Update all libraries window appears with details about all of the libraries for which updates are available.

  2. Click Update all.

Note: Updating all top-level libraries does not automatically update all library dependencies.

To update to the latest version of a specific library, click the Update to latest button () to the right of the library name on the Libraries tab.

To check out a specific library version:

  1. Click the chevron next to the Update to latest button to the right of the library name on the Libraries tab.

  2. Click Check out to version.

    The Update <library_name> to version... window appears.

  3. Select a branch or tag. Note that checking out to a tag puts the library in detached head state.

  4. Click Update Library. The library is checked out to the tip of the selected branch and the .lib file is updated.

Fixing library problems

When there are problems with any of the libraries in an active program - for example, if you do not have a library's source downloaded, or if you check out a new commit of a program that refers to a library commit you do not have checked out - the Fix all problems button at the top right corner of the Libraries tab indicates the number of fixes required.

Click the Fix all problems button to view details about the required fixes.

You can fix all of the libraries in the active program in one click, or you can fix each library individually.

To fix all library problems in a program:

  1. Click the Fix all problems button () at the top right corner of the Libraries tab.

    The Fix all problems window appears with details about all required fixes.

  2. Click Fix all.

To fix a specific library, click the Fix problems button to the right of the library name on the Libraries tab.

Source-controlling library updates

.lib files describe the libraries in your program. To share library changes with collaborators, commit .lib file changes to your program's source control repository. Do not add the library directory and its contents to your program repository. Note: The .lib file only identifies the commit that you are using; it does not include branch information. In Mbed Studio, you can check out a library to the tip of a specific branch, but this information will not be included if you open your program repository in another application, or if you push changes to a remote repository.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.