Link to home
Start Free TrialLog in
Avatar of DJ_AM_Juicebox
DJ_AM_Juicebox

asked on

where to place library files under linux

Hi,

Is there any common place you put libraries used for developing apps under linux? When developing for win32, I  usually make a folder under C:\ called "lib". Then all users can access any library under c:\lib.

Under linux, it seems there's already a folder called "lib". Is it proper to dump my libraries into there, or should I create some separate folder to differentiate? Also, it looks like in the /usr folder on my system we have a copy of the lib folder - what is the purpose of having /lib, and then usr/lib?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
BTW, to reference a particular library that is not placed there, use

-L/path/to/other/lib

to specify that directory on teh compiler's/linker's command line. As the man page says:

      -Ldir  Add  directory dir to the list of directories to be
             searched for `-l'.

      -llibrary
             Use the library named library when linking.

             The  linker searches a standard list of directories
             for the library, which is  actually  a  file  named
             `liblibrary.a'.   The linker then uses this file as
             if it had been specified precisely by name.

             The directories searched include  several  standard
             system  directories  plus any that you specify with
             `-L'.