pkg-config 找不到 opencv [英] pkg-config can't find opencv

查看:383
本文介绍了pkg-config 找不到 opencv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 lubuntu 12.10 发行版上安装了 opencv.然后,当我尝试编译使用 opencv 的代码时,它说找不到它.所以我在终端中尝试:

I installed opencv on a lubuntu 12.10 distro. Then when I try to compile a code which is using opencv it says it can't find it. So I try in a terminal :

pkg-config --cflags --libs opencv

它回答我说找不到 opencv.但是这些文件安装在/usr/lib 中.我不明白为什么它找不到它们.

It answers me that it can't find opencv. But the files are installed in /usr/lib. I don't understand why it can't find them.

推荐答案

您必须将 pkg-config --cflags --libs opencv 放在 g++ 行的末尾.例如:

You have to put pkg-config --cflags --libs opencv at the end of your g++ line. For example :

g++ test.cpp -o test `pkg-config --cflags --libs opencv`

编译

g++ `pkg-config --cflags --libs opencv` test.cpp -o test

不能编译并且有未定义的引用.

Doesn't compile and have undefined reference.

这篇关于pkg-config 找不到 opencv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆