As long as I include any opencv code, the Qt program will fail. Qt 5.1.1 & opencv 2.4.4



  • Hello, I have been trying my best to set up QT & opencv environment. Problems appear and I get over them....
    However, after the environment was probably set up finally, I came across a so so puzzling problem.

    Problem
    As long as I include any opencv code in Qt project, the program will not work.
    well, I've included the LIBS, the includepath, and the opencv bin directory.
    here is my pro file code
    !http://i.imgur.com/wubnDs6.jpg()!
    here is my main.cpp code. This works nicely.
    !http://i.imgur.com/36o44QR.jpg()!
    !http://i.imgur.com/78XkuRw.jpg()!

    if I add the opencv code 'Mat image', the program will run like this
    !http://i.imgur.com/nrPGUmN.jpg()!
    !http://i.imgur.com/AjnXYky.jpg()!

    no any information....
    no compiling errors...
    My Qt version is Qt 5.1.1+mingw 4.8 32bit
    So.....Can anybody help me with this problem?? Thanks a lot..


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You must provide the path to your opencv dlls for your application to start. Update the PATH environment variable in the run panel for your project



  • Thank you so much!!
    Just as you said I updated the PATH environment variable in Qt projects configuration, and the program worked good. I found a deadly mistake that Qt cannot recognize SPACE, so the directory of bin or opencv should not include any SPACE.

    I changed my PATH as the picture shows below. I hope it can help others with same problem.
    !http://i.imgur.com/FBMxPgc.jpg()!

    Finally, thank you again for your reply.
    [quote author="SGaist" date="1383341028"]Hi and welcome to devnet,

    You must provide the path to your opencv dlls for your application to start. Update the PATH environment variable in the run panel for your project[/quote]


  • Lifetime Qt Champion

    You're welcome !

    Spaces are not specially a problem from Qt, it's global for Windows dev tools. That's why Qt's installer put it in a path without spaces and that it's recommended that all 3rd party libraries (e.g. mysql) also be installed in path without spaces. It simplifies development a lot. You can have a look at the quote function of qmake if you have paths with spaces and ultimately there's the 8.3 notation that can be used


Log in to reply
 

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