Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to save my C++ libraries? (Ubuntu)

I am not sure this strictly a programming question, so I apologize if it is not.

I developed a few libraries in C++ that I mean to use in several different projects. Till now I kept copying the updated library in the folders of the various projects. As you can imagine this is not ideal, so I would like to create a "3rd-parties" folder where I save the libraries I write and other that I might download in the future.

How can I do this? And considering I'll want to share/release my code later on what is the best strategy to be sure that the used libraries are included in the code I deploy?

like image 832
lucacerone Avatar asked Feb 19 '23 13:02

lucacerone


2 Answers

There are no hard and fast rules. But if these are 1) general-purpose, for 2) global sharing, then I'd suggest /usr/local/lib (for your .a and .so libraries) and /usr/local/include (for the corresponding headers).

Here's a good description of "standard file locations" for Linux:

  • http://tldp.org/LDP/Linux-Filesystem-Hierarchy/html/Linux-Filesystem-Hierarchy.html
like image 117
paulsm4 Avatar answered Feb 26 '23 22:02

paulsm4


If you want to share your modules with new project its better to organise them in a single folder and mark this folder as included library path in your new projects.

like image 36
perilbrain Avatar answered Feb 26 '23 23:02

perilbrain