4

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?

2 Answers 2

6

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:

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Paulsm, actually for the moment I'm still developing them, but already using them in a few projects. Probably the best for me is to use them as suggested by Anon and move them when they're stable enough. Just a small question.. what are .a and .so files? When I compile my libraries I always obtain .o or .d files..
@LucaCerone:- .a is archive file in linux and .so is shared object library files..More info at yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html
2

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.

3 Comments

Ok Anon, and how do I do this? I'm a rookie programmer (unless you don't count Matlab programming) and all of this is a bit new to me.. In particular what I don't get is: marking the folder as included library path is a compiler thing? or an Ide thing? (or is it a compiler thing that can be managed by IDEs like Eclipse, just to mention the one I use :p)
Yes, exactly. Whatever compiler or IDE you use, you should be able to specify 1) a path for #include files ("-I" for gcc) and 2) a path for library files ("-l" for ld).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.