Where does opencv install it's libs in ubuntu

流过昼夜 提交于 2019-12-20 10:49:13

问题


I have ubuntu 10 installed. I installed all the opencv packages I could find in the software center. I expect that it installs some .lib files somewhere that I can reference in my project, but I can't find them. Where does it put them?

I want to use eclipse as the ide programming in c++, but I am having problems finding out how to get it setup initially. I am new to programming in eclipse and ubuntu in general so if anyone has a step by step guide I would love to see it.


回答1:


You can find the proper link flags using pkg-config --libs opencv and the proper includes using pkg-config --cflags opencv.

The actual libraries should be installed in /usr/lib and having names such as libhighgui.a or libhighgui.so, but you likely won't have to reference those directly. Just use the output of the above commands in the proper place in Eclipse for setting link flags and include directories. If you really do want to know which libs are OpenCV related, the output of pkg-config --libs opencv will give you the names. For example, one of the outputs of that command is -lhighgui, so we know there should be a file named libhighgui.so in /usr/lib.

I haven't used Eclipse in a while for C or C++, so I can't remember where those options are, but they are around somewhere.




回答2:


As stated by Eric

pkg-config --libs opencv

will return libs to be included and if it is about the include file paths

it is /usr/include/opencv and if you want it to be automatically added just add following to command along with the command by Eric --cflags to above command.

Eg. let the file to be compiled be test.c then whole command will be

g++ test.c `pkg-config --libs --cflags opencv`

hope it helps.




回答3:


dpkg -L opencv will give you a list of all files installed from the opencv package. Be warned, however, that it won't show files that aren't in the package itself but get generated when the package is installed. Not being familiar with opencv, I don't know whether this will be a problem for you.




回答4:


OpenCV libraries are installed as in .a(static library) or .so(dynamic library) format.

You can find OpenCV2 (i.e. C++ version) libraries (e.g. libopencv_core.so,libopencv_highgui.so etc) at /usr/local/lib. If you want libraries for c version only (e.g. libcv.a,libcxcore.a etc) you can find them at /usr/lib.



来源:https://stackoverflow.com/questions/3122448/where-does-opencv-install-its-libs-in-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!