在 VS2015 中构建一个简单的 OpenCV 应用程序时出现错误 'cv': a namespace with this name does not exist while building
虽然我相信我已经完成了为 VS 配置 OpenCV 所需的所有步骤(使用本文作为引用 http://opencv-srf.blogspot.com/2013/05/installing-configuring-opencv-with-vs.html )
类(class)的开始很简单
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/stitching.hpp"
#include "opencv2/core/core.hpp"
#include "stdafx.h"
using namespace std;
using namespace cv;
由于 Visual Studio 不会在 #include 上抛出任何错误,我假设 C/C++ -> General -> Additional Include Directories 中的配置是正确的。
在 Linker -> General -> Additional Library Dependencies 我添加了 opencv\build\x64\vc14\build\lib
文件夹。
在 Linker -> Input -> Additional Dependencies 我有以下两个库:
opencv_world320.lib
opencv_world320d.lib
此文件夹中没有其他内容。文件夹 opencv/build/x64/vc14/bin
已添加到 PATH。
感谢任何检查/更改的建议:)
最佳答案
我也遇到过这个问题,解决方案简单得令人抓狂:
#include "stdafx.h"必须是第一个 #include。
OpenCV 人员提供的示例没有提及这一点,即使他们提供了专门使用 visual studio 执行此操作的示例。
关于c++ - '简历' : a namespace with this name does not exist while building (VS 2015, OpenCV 3.2),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43015802/