I have seen that if I do:
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
I am getting some errors:
/usr/local/include/opencv2/core/mat.hpp:58:28: error: invalid use of incomplete type ‘class cv::Mat’
inline void Mat::initEmpty()
^
/usr/local/include/opencv2/core/base.hpp:526:18: error: forward declaration of ‘class cv::Mat’
class CV_EXPORTS Mat;
^
....
And if I change the includes to:
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
all the errors (much more than the two mentionned) disappear. I am using OpenCV 2.4 on Ubuntu 14.
Could it be because of the linking? I use CMake and it looks like this:
#...
find_package(OpenCV REQUIRED COMPONENTS
core
highgui
imgproc
)
#...
include_directories(
${OpenCV2_INCLUDE_DIRS}
#...
)
#...
target_link_libraries(${EXECUTABLE_NAME}
${OpenCV_LIBS}
#...
)
install(TARGETS ${EXECUTABLE_NAME} RUNTIME DESTINATION bin)