OpenCV头文件中可能的命名空间错误

时间:2019-05-16 00:17:13

标签: c++ opencv

我现在刚刚进入C ++的OpenCV(4.1.0)(这两者都是相对较新的),并且由于仅包含一些头文件,我得到了一个奇怪的错误。 (GCC 6.3.0)

错误:

                 from c:\Users\Logan\Projects\Code\C++\webcamTest.cpp:1:
C:\Users\Logan\Projects\Code\C++\Includes\opencv\build\include/opencv2/core/utility.hpp:697:14: error: 'recursive_mutex' in namespace 'std' does not name a type
 typedef std::recursive_mutex Mutex;
              ^~~~~~~~~~~~~~~
C:\Users\Logan\Projects\Code\C++\Includes\opencv\build\include/opencv2/core/utility.hpp:698:25: error: 'Mutex' is not a member of 'cv'
 typedef std::lock_guard<cv::Mutex> AutoLock;
                         ^~
C:\Users\Logan\Projects\Code\C++\Includes\opencv\build\include/opencv2/core/utility.hpp:698:25: error: 'Mutex' is not a member of 'cv'
C:\Users\Logan\Projects\Code\C++\Includes\opencv\build\include/opencv2/core/utility.hpp:698:34: error: template argument 1 is invalid
 typedef std::lock_guard<cv::Mutex> AutoLock;

代码:

#include <opencv2/core.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>

int main()
{

    return 0;
}

在我看来,标题设置方式似乎是一个错误,但是也许我没有正确设置某些内容?

当前我正在使用的命令如下: g++ -std=c++11 -g -I C:\\Users\\Logan\\Projects\\Code\\C++\\Includes\\opencv\\build\\include -o C:\\Users\\Logan\\Projects\\Code\\C++\\Bins\\<File name I'm using in the editor>.exe <File I'm using in the editor>

0 个答案:

没有答案