Ask Your Question

compiler errors when certain header files are included

asked 2014-05-03 09:12:41 -0500

chatumao gravatar image

updated 2014-05-03 09:13:45 -0500

Hello there, I stumbled over a very weird thing just now. I include the following three header files: highgui.h, opencv.hpp, windows.h. When all three are active, I get one C2059 and two C2589, all in objdetect.hpp on line 338. Leaving out one of them, no matter which, all is well. Changing the order of the includes also remedies the situation. Following order does not work:

highgui.h windows.h opencv.hpp

Everything else seems to be fine. Can someone verify/explain this behaviour? Should'nt be headerfiles be immune to such erratic behavior? In this case, there was little harm done, but still I had to revert my work back to one hour earlier because I could not figure out what I had done wrong (nothing, as I know now).

Thanks to anyone looking into this.

EDIT: I am using version 2.4.9 on x86 Windows with Qt Creator.

edit retag flag offensive close merge delete


I do not really know what causes the mentioned error but since highgui.h is an C header file and opencv.hpp is an C++ header file, you could try: highgui\highgui.hpp windows.h opencv.hpp.

tuannhtn gravatar imagetuannhtn ( 2014-05-03 09:52:48 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-05-03 16:09:12 -0500

FLY gravatar image
#include "opencv/highgui.h"


#include "opencv2/highgui/highgui.hpp"

depending on you using the c or c++ interface in opencv , may be your mixing the interface or anything related to this in your code , it can be better figure out if you upload sample code. You should try using your code with one of the above libraries. From here we can check out that highgui - an easy-to-use interface to video capturing, image and video codecs, as well as simple UI capabilities. Check your code from where you use these functionalities , check if your mixing interface there or not , if not then check your code with one the above libraries , if it not solved then post your sample code here

edit flag offensive delete link more

Question Tools


Asked: 2014-05-03 09:12:41 -0500

Seen: 993 times

Last updated: May 03 '14