eclipse opencv 在哪里安装它的库在 ubuntu

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3122448/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 19:28:23  来源:igfitidea点击:

Where does opencv install it's libs in ubuntu

eclipseubuntuopencveclipse-cdt

提问by Mr Bell

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?

我安装了 ubuntu 10。我安装了我可以在软件中心找到的所有 opencv 包。我希望它会在我可以在我的项目中引用的某个地方安装一些 .lib 文件,但我找不到它们。它把它们放在哪里?

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.

我想使用 eclipse 作为 C++ 中的 ide 编程,但我在寻找如何设置它时遇到了问题。我是 eclipse 和 ubuntu 编程的新手,所以如果有人有分步指南,我很乐意看到它。

回答by Eric Perko

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

您可以pkg-config --libs opencv使用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 opencvwill 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.soin /usr/lib.

实际的库应该安装在 /usr/lib 中,并具有诸如 libhighgui.a 或 libhighgui.so 之类的名称,但您可能不必直接引用它们。只需在 Eclipse 中的适当位置使用上述命令的输出来设置链接标志和包含目录。如果您真的想知道哪些库与 OpenCV 相关,输出pkg-config --libs opencv将给您名称。例如,该命令的输出之一是 -lhighgui,所以我们知道应该有一个名为libhighgui.so/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.

我有一段时间没有将 Eclipse 用于 C 或 C++,所以我不记得这些选项在哪里,但它们就在某个地方。

回答by skjoshi

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/opencvand if you want it to be automatically added just add following to command along with the command by Eric --cflagsto above command.

它是/usr/include/opencv,如果您希望它自动添加,只需将以下命令与 Eric 的命令一起添加--cflags到上面的命令中。

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

例如。让要编译的文件是 test.c 然后整个命令将是

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

hope it helps.

希望能帮助到你。

回答by Partha Bera

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

OpenCV 库以 .a(静态库)或 .so(动态库)格式安装。

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.

您可以在/usr/local/lib. 如果您只需要 c 版本的库(例如 libcv.a、libcxcore.a 等),您可以在/usr/lib.

回答by Paul Kuliniewicz

dpkg -L opencvwill 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.

dpkg -L opencv将为您提供从 opencv 包安装的所有文件的列表。但是请注意,它不会显示不在包本身中但在安装包时生成的文件。不熟悉opencv,不知道这对你来说会不会有问题。