如何链接和使用OpenCV头? [英] How to link and use OpenCV headers?

查看:117
本文介绍了如何链接和使用OpenCV头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对,我知道这是一个非常愚蠢的问题,但我没有运气w / e我想做。



我试图使用objdetect.hpp头文件,所以我已经包括文件夹C:\OpenCV2.1 \include\opencv2\以及C:\OpenCV2.1 \include\opencv和一大堆其他图书馆和dll,当我按照 http://opencv.willowgarage.com/ wiki / VisualC%2B%2B_VS2010



但是该教程中的openCV版本已过时,甚至没有objdetect.hpp文件。所以我去下载最新的一个(OpenCV 2.4.0),但现在当我补充它,它给我一个错误C1083:无法打开包含文件:opencv2 / core / core.hpp没有这样的文件目录。 p>

我是否需要将所有OpenCV文件夹/文件放在同一个目录中作为我的C ++项目?或者如何解决它?我试过把它放在同一个地方作为我的C ++项目,但是当我做一个 #include../\"文件夹不出现。



再次,我知道这是一个愚蠢的问题,但请帮助。



让我知道如果有人需要更多信息coz



感谢

解决方案

管理包含文件的更改目录的最好方法是使用编译器选项。 im在linux和g ++,你只需指定不同的包含路径位置与 -I 属性。



一般认为在 #include 语句中使用相对路径和绝对路径是不好的做法。模块路径确定 #include< sys / time.h> ,其中 sys 可以被认为是模块。包含只包含其名称和可能的模块的文件,然后使用编译器选项处理该位置。


Right, I know this is a very stupid question, but I have no luck with w/e i'm trying to do.

I'm trying to use the objdetect.hpp header file, so I've included the folder C:\OpenCV2.1\include\opencv2\ aswell as C:\OpenCV2.1\include\opencv and a whole bunch of other libraries and dlls when I was following the instructions on http://opencv.willowgarage.com/wiki/VisualC%2B%2B_VS2010

But the openCV version in that tutorial were outdated and doesn't even have the objdetect.hpp file. So I went to download the latest one (OpenCV 2.4.0), but now when I complie it, it gives me an error C1083: Cannot open include file: "opencv2/core/core.hpp" No such file directory.

Am I suppost to put all the OpenCV folders/files in the same directory as my C++ project? Or how do I fix it? I've tried putting it in the same place as my C++ project, but when I do a #include "../" the folder doesn't appear.

Again, I know this is a stupid question, but please help.

Let me know if anyone require more info coz I'm not too sure whatelse to put.

Thanks

解决方案

The best way to manage changing directories for include files is with the compiler options. Im better at linux and g++, where you would just specify different include path locations with -I attributes.

Its generally considered bad practice to use relative and absolute paths in the #include statements. Module paths are ok #include <sys/time.h>, where sys could be considered the module. Include the file with just its name and possibly the module, then handle the location with the compiler options.

这篇关于如何链接和使用OpenCV头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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