Can't add iOS OpenCV Framework in a QT Project



  • I'm trying to bind the OpenCV Framework which is available for iOS to a Qt 5.2 iOS Project. So far without any useful result.

    What works is to create the Qt Project without any OpenCV Framework binding, then generate a Xcode Project with quake (using command "qmake -spec macx-xcode qtopencv.pro") and then manually add the iOS OpenCV Framework to the Xcode Project. The resulting App then runs perfectly with OpenCV Support. But if I want to add a File to the Project or something effecting the Project structure then I need to use qmake and add the OpenCV Framework manually every time.

    So I need a way to tell the QT Project to use the already existing OpenCV iOS Framework and to use it automatically. After doing some research on qmake I found out that there is the possibility to add an Mac/iOS Framework.

    Using following commands in the QT Pro file the Frameworkfiles seem to be added to the Project (The OpenCV Framework seems to be correctly added into the Project as it can be found in the Framework section in the qmake generated Xcode Project):

    @QMAKE_LFlags += -F"/Users/divdurch0/Desktop/qtopencv/OpenCV.framework"
    LIBS += -framework "/Users/divdurch0/Desktop/qtopencv/OpenCV.framework"@

    But now the Project is not compiling saying "ld:framework not found -L/Users/divdurch0/Qt5.2.1/ios/plugins/platforms". The mentioned path is not an Framework it is a lib and is correctly found as Lib if I don't add above mentioned lines - so it shouldn't be the problem.

    if I change the second line as described in several answers on the net to

    @LIBS += -framework OpenCV@

    it says Framework OpenCV not found and the Framework files aren't added to the qmake resulting Xcode Project.

    I hope someone knows how to do this. There must be a way maybe I am using the wrong syntax. Or any other way to add the OpenCV Framework to a iOS QT Project will be helpful.

    Thanks.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    LIBS += \
        -F /Users/divdurch0/Desktop/qtopencv \
        -framework OpenCV
    

    And you should be good to go

    [edit: updated coding tags SGaist]



  • Ah so simple, thank you very much!


  • Lifetime Qt Champion

    You're welcome !

    Sometimes it's a bit less hard ;)

    Since you have it working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.