2016-09-20 90 views
2

我已经安装了OpenCV 3.10并链接了opencv_world310.libreleaseopencv_world310d.lib进行调试。 此外,我把搜索目录中的编译器选项设置为...opencv\build\include。当我遗漏了#include <opencv2/highgui.hpp时,我得到了一个未定义的参考错误。现在,我已经包括它在我的代码如下所示:OpenCV3.10 core.hpp必须编译为C++

#include <stdio.h> 
#include "opencv/cv.h" 
#include "opencv/highgui.h" 
#include <opencv2/highgui.hpp> 


int main(void){ 

printf("HALLO!"); 


return 0; 
} 

当我尝试建立它core.hpp打开,error: core.hpp must be compiled in C++发生。 我在Codeblocks中使用GNU GCC编译器。 我该怎么做才能解决问题?

回答

0

检查你的编译器选项。打开CV 3.10 C++ API需要将代码编译为C++,但不是C.您可以使用回答"CodeBlocks: change project language c and c++"问题来更改选项。

还采用新的开放CV 3.10 API

#include <opencv2/opencv.hpp>` 

,而不是其他所有打开CV头文件。该标题包含核心功能。要启用highgui模块,您需要在项目设置中定义HAVE_OPENCV_HIGHGUI

+0

感谢您快速回答它解决我的问题! – albert

相关问题