I installed opencv on my mac mountain lion using the mac port. Then I wrote a OpenCV_util.cc file that has:
#include <cv.h>
#include <cvaux.h>
#include <highgui.h>
When I tried to compile it with g++ OpenCV_util.cc, I got the following error:
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
Then I used
g++ OpenCV_util.cc -I /opt/local/include/opencv -L /opt/local/lib
The compiler found cv.h, cvaux.h, and highgui.h. However, I got the following error:
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
...... (A lot of errors like this)
I checked /opt/local/include/opencv2/core/, all the files were there. I think it's because in cv.h, it has:
#include "opencv2/core/core_c.h"
#include "opencv2/core/core.hpp"
but not the absolute path.
How can I solve this ?
I don't think you should include /opt/local/include/opencv. You probably should just use this path: /opt/local/include/ and use opencv or opencv2 where needed when using #include
For example
#include <opencv/cv.h>
#include <opencv/cvaux.h>
#include <opencv/highgui.h>
and something like:
g++ OpenCV_util.cc -I /opt/local/include/ -L /opt/local/lib
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With