简体   繁体   English

使用openmp和opencv库编译cpp文件时出现OpenCV致命错误

[英]OpenCV fatal error while compiling a cpp file with openmp and opencv libraries

I have a cpp project that uses both OpenCV and OpenMP. 我有一个同时使用OpenCV和OpenMP的cpp项目。 While compiling the file in the terminal I am getting fatal error that says: 在终端中编译文件时,出现致命错误,提示:

No package 'opencv' found main.cpp:3:39: fatal error: opencv2/imgproc/imgproc.hpp: No such file or directory #include compilation terminated. 没有找到包'opencv'main.cpp:3:39:致命错误:opencv2 / imgproc / imgproc.hpp:没有这样的文件或目录#include编译终止。

I tried to add all path to hpp file but then it wants other headers used in the imgproc.hpp. 我试图将所有路径添加到hpp文件,但随后它需要imgproc.hpp中使用的其他标头。

This is what i am trying to compile: 这是我要编译的内容:

g++ main.cpp -fopenmp -o aplication pkg-config --cflags --libs opencv -std=c++11 g ++ main.cpp -fopenmp -o复制pkg-config --cflags --libs opencv -std = c ++ 11

Sorry if that is a stupid question I am trying to learn. 抱歉,这是我要学习的愚蠢问题。 Thanks for any help. 谢谢你的帮助。

What opencv version are you using, and where are the headers and libraries installed? 您使用的是哪个opencv版本,头文件和库安装在哪里?

seems that pkg-config cannot find opencv. 似乎pkg-config无法找到opencv。 Try pkg-config --list-all | 尝试pkg-config --list-all | grep opencv to see if it can find. grep opencv看看是否可以找到。

If opencv is installed in a customized dir, you should defined an environmental variable PKG_CONFIG_PATH. 如果opencv安装在自定义目录中,则应定义环境变量PKG_CONFIG_PATH。

You can also post the results of the pkg-config command. 您也可以发布pkg-config命令的结果。 It helps to solve your problem. 它有助于解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM