Roy Li
Roy Li

Reputation: 325

Better practice of using static libraries in Unix?

I am new to unix. This is the first time I am trying work with an external library(Ogre3D) on a Mac. I do not want to dump all of the .lylib files in into the /usr/lib directory since I might want to delete these files once I do not need them and it's hard to differentiate them form other library files. When I create a new folder named Ogre in the /usr/lib/ directory to host my Ogre library files it seems I cannot access these files when compiling files using -l flags to specify the location. So I am wondering if it's necessary to put all the files in the /usr/lib/ rather than putting them into a folder inside the /usr/lib/?

And I wondering that if it is possible to put the includes folder directly into /usr/includes/ so I can access the header files? Or I have to put all the headers in the /usr/includes/?

Upvotes: 1

Views: 135

Answers (1)

user529758
user529758

Reputation:

So I am wondering if it's necessary to put all the files in the /usr/lib/ rather than putting them into a folder inside the /usr/lib/?

No. There's the -L<dir> linker flag which makes the compiler search dir along with the standard library paths.

And I wondering that if it is possible to put the includes folder directly into /usr/includes/ so I can access the header files?

Even more choices here. Either put them in /usr/include/foo and then

#include <foo/foo.h>

(preferred) or put them in /usr/include/foo, use the -I/usr/include/foo compiler flag, and write

#include <foo.h>

Upvotes: 2

Related Questions