error: #error core.hpp header must be compiled as C++
Hi all , i'm trying to build an example of face detection found here https://github.com/tasanakorn/rpi-mma... to use it with raspberry pi camera module but when i do make i get the following error In file included from /usr/local/include/opencv2/objdetect.hpp:47:0, from /usr/local/include/opencv2/objdetect/objdetect.hpp:48, from /home/pi/opencv-3.0.0/samples/cpp/test/rpi-mmal-demo-develop/opencv_demo.c:12: /usr/local/include/opencv2/core.hpp:49:4: error: #error core.hpp header must be compiled as C++ In file included from /usr/local/include/opencv2/core.hpp:54:0, from /usr/local/include/opencv2/objdetect.hpp:47, from /usr/local/include/opencv2/objdetect/objdetect.hpp:48, from /home/pi/opencv-3.0.0/samples/cpp/test/rpi-mmal-demo-develop/opencv_demo.c:12: /usr/local/include/opencv2/core/base.hpp:49:4: error: #error base.hpp header must be compiled as C++ /usr/local/include/opencv2/core/base.hpp:52:19: fatal error: climits: No such file or directory compilation terminated. CMakeFiles/mmal_opencv_demo.dir/build.make:54: recipe for target 'CMakeFiles/mmal_opencv_demo.dir/opencv_demo.c.o' failed make[2]: * [CMakeFiles/mmal_opencv_demo.dir/opencv_demo.c.o] Error 1 CMakeFiles/Makefile2:95: recipe for target 'CMakeFiles/mmal_opencv_demo.dir/all' failed make[1]: [CMakeFiles/mmal_opencv_demo.dir/all] Error 2 Makefile:72: recipe for target 'all' failed make: ** [all] Error 2
rename your file to opencv_demo.cpp (else the wrong compiler / toolchain gets called)
also, the code you want to compile, seems rather outdated. opencv moved away from the c-api half a decade ago, and support for it is fading rapidly. wherever you see code containing IplImage* and cv* functions, - rather walk on, and leave it in its well deserved grave.
if you're still not convinced, the face detection won't work with today's cascade files any more, the format changed, and the old c-api funcs can't read it.