0

I have been able to successfully integrate opencv with Qt using the following tutorial:

How to link opencv in QtCreator and use Qt library

However, When I try to write line #include "opencv/cv.h in my .cpp file, qt throws me an error:

D:\opencv\opencv_bin\install\include\opencv2\flann\saving.h:113: error: exception handling disabled, use -fexceptions to enable
     throw FLANNException("Invalid index file, cannot read");
                                                           ^

I am not sure if this is a qt problem or an opencv installation problem.

TEMPLATE = app
TARGET = cube4
QT += 3d
SOURCES = cubeview.cpp main.cpp \
    haptics.cpp
HEADERS = cubeview.h \
    haptics.h \
    src/haptics.h \
    src/adll.h \
    src/afuncs.h \
    src/atypes.h \
    src/avars.h \
    src/glut.h \
    src/StdAfx.h \
    hdl/hdl.h \
    hdl/hdlConstants.h \
    hdl/hdlErrors.h \
    hdl/hdlExports.h \
    hdlu/hdlu.h \
    hdlu/hdluExports.h
HEADERS += \
    Widget.h
RESOURCES = cube.qrc

win32:LIBS += -LD:\\opencv\\opencv_bin\\bin \
    libopencv_core248d \
    libopencv_highgui248d \
    libopencv_imgproc248d \
    libopencv_features2d248d \
    libopencv_calib3d248d \


win32: INCLUDEPATH +="D:/opencv/opencv_bin/install/include"
3
  • Which compiler are you using? is it gnu compiler? Commented Nov 28, 2014 at 9:44
  • I am using mingw compiler Commented Nov 28, 2014 at 9:47
  • you need to enable exceptions. Read this, stackoverflow.com/questions/13401719/… Commented Nov 28, 2014 at 9:51

1 Answer 1

1

Thanks iHarob. The solution was to add "exceptions" to the CONFIG variable in your project file (the *.pro file):

CONFIG += exceptions This takes care of passing the correct compiler flags. The answer can be found here: How to enable exception handling in mingw

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.