#include< opencv2/opencv.hpp>在VS 2013中无法正常工作 [英] #include <opencv2/opencv.hpp> not working in VS 2013
问题描述
我有VS2013社区版,我刚刚将OpenCV安装在目录c:\ openCV3中,并且有一个build子文件夹,其中包含include子文件夹,等等,一切看起来都很正常.所以我用#include <opencv2/opencv.hpp
行创建了一个空项目,但得到
I have VS2013 community edition, I just installed OpenCV in a directory c:\openCV3 and there is a build subfolder with an include subfolder of that etc, everything lo looks normal. So I create an empty project with the line#include <opencv2/opencv.hpp
but I get
错误1错误C1083:无法打开包含文件:'opencv2/opencv.hpp':没有这样的文件或目录d:\ devt \ cplusplus \ opencv \ test1 \ test1 \ source.cpp 1 1 Test1
Error 1 error C1083: Cannot open include file: 'opencv2/opencv.hpp': No such file or directory d:\devt\cplusplus\opencv\test1\test1\source.cpp 1 1 Test1
但是我已经将项目的其他包含目录修改为此:
However I have modified my project's additional include directories to this:
C:\OpenCV3\build\include\opencv;C:\OpenCV3\build\include\opencv2;C:\OpenCV3\build\include;%(AdditionalIncludeDirectories)
但是什么也没做,错误不会消失.以前几乎已经问过相同的问题,但答案对我不起作用.
But nothing doing, the mistake does not go away. Pretty much the same question has been asked before but the answers do not work for me.
更新: 我右键单击,然后在弹出菜单中选择"OpenDocument". 我收到以下消息框: 我感到惊讶的是,这里没有提到我的其他包含目录集.
Update: I right clicked on and, in the popup menu chose OpenDocument. I got the following message box: What I found surprising is that there is no mention of my set of additional Include directories.
推荐答案
而不是使用包含C:\ OpenCV3 \ build \ include \ opencv和C:\ OpenCV3 \ build \ include \ opencv2,请尝试使用C:\OpenCV3\build\include\
.调用包含文件时,您已经在告诉您正在使用的文件夹:
Instead of use the includes C:\OpenCV3\build\include\opencv and C:\OpenCV3\build\include\opencv2, try to use C:\OpenCV3\build\include\
. When you call an include you're already telling the folder you are using:
#include <opencv2/opencv.hpp>
在这种情况下,VS在文件夹opencv2中搜索opencv2/opencv.hpp ... VS必须在文件夹include中搜索,因此它将找到opencv2/opencv.hpp ...
In that case, VS is searching opencv2/opencv.hpp in folder opencv2... VS must search in the folder include, so it will found opencv2/opencv.hpp...
(或者您可以尝试将包含内容修改为"#include"
(or you can try to modify your include to "#include "
希望有帮助.
这篇关于#include< opencv2/opencv.hpp>在VS 2013中无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!