Ask Your Question
0

error: #error core.hpp header must be compiled as C++

asked 2015-07-10 09:29:15 -0600

franken gravatar image

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

edit retag flag offensive close merge delete

Comments

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.

berak gravatar imageberak ( 2015-07-10 09:35:02 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-06-21 04:14:35 -0600

HariKrishnan gravatar image

Rename the related *.m files to *.mm and *.h to *.hpp. This works for me.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-07-10 09:29:15 -0600

Seen: 8,183 times

Last updated: Jul 10 '15