cancel
Showing results for 
Search instead for 
Did you mean: 

Need help to link a library (.h .cpp)

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

5 REPLIES 5
Javier1
Principal

What i usually do is just drag and drop my .h files inside Core/Inc folder, and my .cpp files inside my Core/Src folder.

Then after clicking refresh in the IDE youll be able to see them and #include"" them.

Or you want to add libraries from a different fixed external location?

we dont need to firmware by ourselves, lets talk
Andrew Neil
Evangelist III

When the IDE talks about a "library" it means a pre-built binary (.a).

What you have is just source files - which is handled in exactly the same way as any other source files.

Hello, Thank you for you answer, yeah I use the term "library" a bit lightly.

For what I understood I should not have added my folder in "Library Path" but i'v tried it when nothing else worked.

Hello, Thank you for your help!

I effectively try to add a librairie (as sources) from a fixed external location in link form.

I have tried to link my files directly in the core/Inc and core/Src but i have the same issue...

next to my linked TesClass.h, I have make a TryTwo.h files (actualy a file not a link) witch work fine.

So i think my issue is in the linking of the sources. Is there an other solution to achieve the same goal and not avec a copy of my lib in every projects?

JB.2
Associate II

Hello.

I manage to do the linking using windows hard link but this is not what I'm searching for, it isn't realy portable and it broke my git ...

I'm pretty shure it can be done in cube ide, can someone help me ?

Thank you