Showing results for 
Search instead for 
Did you mean: 

Include a library

Associate III

Hi. I have seen several tutorials and read in the forum how to include a library. But it does not work. Can someone help me please.




Accepted Solutions
ST Employee

Hello @Giuseppe1 

Can you take a look at the following article and this post. It may be helpful.

Best Regards.


To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Principal III


maybe error msg is right ? There is no such file... 

So you have to "import" it : right click on the directory, you want it to be ->


next -> browse the source , select what want - ready.

This for every source .c or .h (or group of ..) , then the IDE got it.


If you feel a post has answered your question, please click "Accept as Solution".

I created a new folder with the library(.h). Then i imported it : Project->Properties->MCU GCC linker->libraries. but it doesn't work.

A header file is not a library - it just defines the interface to the library.

So, in addition to that header, you will also need the library code itself - either as a pre-built binary, or as source code.

  • You use Project->Properties->MCU GCC linker->libraries to specify a pre-built binary library - see the links posted by @STTwo-32 
  • If it's a source code library, you add all the source to your project, so  that it gets built as part of your project.


This is the file. It's a source code?

It is "source code" in that it is used as input to the compiler. It's not a binary file.

But, again, it's just a header file - as it says, it only contains prototypes - not the functions themselves:



 * @brief   This file contains all the functions prototypes for the
 *          lsm6dso_reg.c driver.



You also need something which contains the actual implementations of those functions - either as source code, or a pre-built binary.

I suggest you look at the X-CUBE-MEMS1 and/or C-Driver-MEMS software packs:





For a better understanding of the difference between declarations and definitions, and how data & functions can be defined in one file, but used in another, see: 

I installed the driver file, now how do you import it?

You'll also have to study the Pack's documentation on how to use it ...