Skip to main content
Associate III
Feb 26, 2024 12:31 PM UTC
Solved

Include a library

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.

Giuseppe1_0-1708950592928.png

 

This topic has been closed for replies.
Andrew Neil
Andrew NeilBest answer
Super User
Mar 4, 2024 3:54 PM UTC

https://community.st.com/t5/stm32cubeide-mcus/include-a-library/m-p/646526/highlight/true#M24844

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

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.

20 replies

STTwo-32
ST Technical Moderator
Feb 26, 2024 1:08 PM UTC

Hello @Giuseppe1 

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

Best Regards.

STTwo-32

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.
Giuseppe1Author
Associate III
Mar 4, 2024 4:00 PM UTC

Thanks!

Andrew Neil
Super User
Mar 4, 2024 5:21 PM UTC

On the distinction between source and binary:

AndrewNeil_0-1709571222181.png

 

Traditionally, "Library" was used to mean a pre-built binary library.

Nowadays, people also commonly speak of source-code libraries.

 

https://www.stackzero.net/compilation-process-in-c/ 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
AScha.3
Super User
Feb 26, 2024 1:11 PM UTC

Hi,

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 ->

AScha3_0-1708952974440.png

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 on " Best Answer ".
Giuseppe1Author
Associate III
Mar 4, 2024 12:28 PM UTC

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

Andrew Neil
Super User
Mar 4, 2024 12:35 PM UTC

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.

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.