无法使用OpenCV命名空间 [英] Can't use OpenCV namespace

查看:189
本文介绍了无法使用OpenCV命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装OpenCV,并认为我已经完成...但这有错误:

  #include< ; cv.h> 
#include< highgui.h>

using namespace cv;

int main(int argc,char ** argv)
{
}

错误:无法解析符号'cv'



包括包括只是罚款。代码本身取自OpenCV.org上的一个例子,所以我认为代码是正确的。我也n00b来诊断问题是什么,只是含糊地知道什么命名空间是...

解决方案

包括C ++头文件,但是C文件。
您应该尝试包括 highgui.hpp 或全局 opencv2.hpp 的文件。



如果这些文件不存在,则必须升级更新版本的库。
如果它们存在但是你的编译器找不到它们,你必须在编译时使用 -I / path / to / include 选项。

I'm trying to install OpenCV and thought I was done... But this has errors:

#include <cv.h>
#include <highgui.h>

using namespace cv;

int main( int argc, char** argv )
{
}

Error: Symbol 'cv' could not be resolved

But apparently the two includes include just fine. The code itself is taken from an example on OpenCV.org so I assume the code is right. And I'm too n00b to diagnose what the problem is, only vaguely knowing what namespaces are...

解决方案

You are not including the C++ headers but the C ones. You should try to include files such as highgui.hpp, or the global opencv2.hpp instead.

If these files do not exist, you have to upgrade for a more recent version of the library. If they exist but your compiler can't find them, you have to use the -I/path/to/include option when compiling.

这篇关于无法使用OpenCV命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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