Ubuntu – Where does Ubuntu store its library files

10.10ccommand linecompiling

I want to add my own library to use in c compiling, but don't really know where ubuntu stores it.

Best Answer

Based on your comments to your question, I think what you are really asking is "How do I install a custom library I wrote and where should I put it?"

In general, things built locally for others on the machine to user are put into the /usr/local tree. The header file should go into /usr/local/include. The compiled library should go into /usr/local/lib. The .c file is not part of the library, it is part of the source and not something normally not installed for the use of the end user. You will need root access to put files in either of these locations.

To build the library, you will need to build first decide if you want a static or dynamic (shared) library. More information on creating a shared library can be foundin section 3.4, Creating a Shared Library at http://www.linux.org/docs/ldp/howto/Program-Library-HOWTO/shared-libraries.html. (They also have recommendation about where to put stuff -- most developers will have an an opinion or three :-) )