Reputation: 1353
I was following this to make my first OpenCV project, showing a picture with imshow() function.
I right clicked on the project and clicked "Add files to..", added libopencv_core.2.4.9.dylib and libopencv_highgui.2.4.9.dylib. Then I added "/usr/local/include" in "Header Search Paths".
However, I met this error: "ld: library not found for -lopencv_highgui.2.4.9".
But if I added "/usr/local/lib" in "Library Search Paths", it worked!
My question is: since I already added libraries in the project, why do I bother to added "/usr/local/lib"?
p.s. I am using Xcode5.1.1 and OpenCV2.4.9
Upvotes: 2
Views: 1005
Reputation: 36
You only added the library name itself. The linker does not know, where to search it. The linker has some default search paths built in (e.g. /lib
or /usr/lib
), but /usr/local/lib
is not one of it. Historically the local path has to store local software only. /usr
could be stored on a network mount. Thus there could be other rights management on /usr/local
and thus it may be a security problem, if ld
would automatically search in this subdirectories per default.
Upvotes: 1