我使用mac端口在我的mac山狮上安装了opencv。然后我写了一个 OpenCV_util.cc 文件,它有:
#include <cv.h>
#include <cvaux.h>
#include <highgui.h>
当我尝试用 编译它时g++ OpenCV_util.cc
,出现以下错误:
OpenCV_util.h:1:16: error: cv.h: No such file or directory
OpenCV_util.h:2:19: error: cvaux.h: No such file or directory
OpenCV_util.h:3:21: error: highgui.h: No such file or directory
然后我用
g++ OpenCV_util.cc -I /opt/local/include/opencv -L /opt/local/lib
编译器找到了 cv.h、cvaux.h 和 highgui.h。但是,我收到以下错误:
In file included from OpenCV_util.h:1,
from OpenCV_util.cc:1:
/opt/local/include/opencv/cv.h:63:33: error: opencv2/core/core_c.h: No such file or directory
/opt/local/include/opencv/cv.h:64:33: error: opencv2/core/core.hpp: No such file or directory
......(很多这样的错误)
我检查了/opt/local/include/opencv2/core/,所有文件都在那里。我认为这是因为在 cv.h 中,它具有:
#include "opencv2/core/core_c.h"
#include "opencv2/core/core.hpp"
但不是绝对路径。
我该如何解决这个问题?