Hello, I have an existing project in MCUXpresso that I would like to create a static library (.a) file from so that I can use the functions and libraries in a future project. I am not sure the best way of going about doing this. I have seen people make static libraries and then link them in other projects in the past. Any guidance on how to do this would be appreciated. Thank you,
Hi,
I also have the same requirement, I have a project and it has built and created .bin file. Now, my requirement is to built the project to static library instead of .bin(executable). I have tried the above steps. Project>Properties>c/c++ General>settings and change the build artifact to Shared library from Executable. Still, it's generating only (.bin) not the shared library.
IDE: MCU Expresso
Please suggest me the steps to create a shared library / static library using my existing project.
Thanks in advance.
a static library (archive) is very different from an application (application entry point, startup, etc). Changing this 'in place' is possible, but you have to know 100% what you are doing.
What I recommend is
a) create a new project with the IDE (here you have the option to select to build a static library)
b) then copy/move over your files you want to have in the library.
I hope this helps,
Erich
Hi @ErichStyger,
As per your comment I have created a "new C library project" for creating library. Later, I have copied all my .c files in source folder and .h folder in to include folder.
Now, if I build my project I was able to get the library. 50% of my requirement completed.
Another 50% is I have to copy a library file generated through some source files as part of my "C library project". Along with my own source and include files I need a library file also part of my project.
Thanks in advance,
Rambabu.
I'm sorry, but I don't understand what you mean?
Is it about how you can manage the library dependencies? Then have a read at https://mcuoneclipse.com/2017/09/19/managing-project-and-library-dependencies-with-eclipse-cdt/
Is it about how to link with a library? Then have a read at https://mcuoneclipse.com/2017/07/23/how-to-use-custom-library-names-with-gnu-linker-and-eclipse/
I hope this helps,
Erich
I have a requirement to link a already generated library file(sum.a) to a newly created library project(new_library_project). Once I build this library project(new_library_project) I will get a output library file(new_library_project.a), which should have the contents of old library file(sum.a).
Hope this is clear.
Thanks in advance.
if you want to combine two archives into one, use this:
ar -rcT libA.a libB.a libAplusB.a
Hi Ryan,
I think the following document will help you.
How to create and use static library in MCUXpresso IDE
Best regards,
Felipe
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
I also want to add that I have tried going to Project > Properties > C/C++ General > Settings and change the build artifact, but the only artifact types available are Shared library and Executable