cancel
Showing results for 
Search instead for 
Did you mean: 

How to link library (.c and .h file) in CubeIDE?

HPham.1590
Senior

Hello, I'm new in STM32CubeIDE.

I want to create my library to use in my C/C++ project.

My library includes 2 files (.c and .h) but I don't know how to linking them in CubeIDE.

Anyone can help me?

Many thanks,

Hieu

14 REPLIES 14
dbgarasiya
Senior II

glad to hear that

JB.2
Associate II

Hello!

I try to link an exisiting library (.h and .cpp files) to a new project but the compilator dont see it

I'v drag the library folder into my project and selected "link files and create virtual folders"

And added de dependancies in the following entries:

In "Linked ressources" in "Path Variable"

In "Path and symbols" in "Include", "Library Path" and "Source Location"

in "Preprocessor Include Path Macros ..." in "CDT User Settings"

I'v put the path to the library folder where I thought it was necesary and after i'v put it everywhere I could >.<

There is no weird characters or spaces in the full path of the project or library.

i'v also tryed to put the linkes to the files in core/src and core/inc or in Middlewares but same issue.

I realy need the files to be linked and not in copie because they are used in the windows client and for the two core projects.

Did I missed or do something wrong ?

Thank you for your help !

Version: 1.6.1

Build: 9958_20210326_1446 (UTC)

Fresh and working project

Win10 Nucleo 144h745zi

Include paths are be in project properties -> C/C++ Build -> Settings -> Tool Settings -> MCU G++ Compiler -> Include paths. If that doesn't fix it, make a new thread and show a screenshot of your include paths.

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

Hello, thank you for your answer !

But the path was already there...

I'v created a new topic on the forum

Deepak.Aagri
Associate III

Yes this works ...

Include paths are be in project properties -> C/C++ Build -> Settings -> Tool Settings -> MCU G++ Compiler -> Include paths.

>Click >> Workspace

0693W00000JOhPNQA1.png