OpenCV error
-
How to diagonise it
-
@Vijaykarthikeyan said in OpenCV error:
but how to correclty link the .dll file in .pro..please someone guide me
You don't link to
.dll
files. You don't mention.dll
files in a.pro
file. You need to stick to examples, they don't.
OK, I think I see, they name the library fileslib....dll.a.
I don't use Windows/MinGW, is it supposed to be-lopencv....dll
? Without the leadinglib
?
But if your code links fine with what you have in the.pro
file that's fine.-lNAME_OF_THE_LIB.lib
I think we are talking MinGW not MSVC here?
lib....a
files.At runtime your program has to find
libopen....dll
file. That needs to be in the same directory as the executable or specified inPATH
. I think yours is not? Where islibopencv_....dll
per error message, I only seelibopencv....dll.a
?@JonB you're absolutely correct..Thanks for clarifying me.Actually,For the previous projects using opencv..i have included one line which I'm missing in this that's why error hits.
Actually when linking third party libraries against to Qt..we must include it's path to qmake flags.
So, we must include this:
# Add the include path to QMAKE_CXXFLAGS QMAKE_CXXFLAGS += -I$$PWD/C:/opencv2/include
-
How to diagonise it
@Vijaykarthikeyan There is nothing to diagnose, simply deploy missing library together with your application
-
@Vijaykarthikeyan There is nothing to diagnose, simply deploy missing library together with your application
already included before asking this question...but till now..unable to diagnose
-
already included before asking this question...but till now..unable to diagnose
@Vijaykarthikeyan I'm not talking about project configuration and build but about deployment
https://doc.qt.io/qt-6/deployment.htmlThe application needs the library at runtime, so it needs to be deployed together with the application.
-
already included before asking this question...but till now..unable to diagnose
@Vijaykarthikeyan
I don't understand: you are using-llib....dll
as libraries to link against, how does that work? But in any case the error is a runtime error failing to locate the.dll
file, I don't see how that is connected to linking. -
@Vijaykarthikeyan
I don't understand: you are using-llib....dll
as libraries to link against, how does that work? But in any case the error is a runtime error failing to locate the.dll
file, I don't see how that is connected to linking.i didnt changed the library name..can i change that
-
i didnt changed the library name..can i change that
@Vijaykarthikeyan What @JonB means is that on Windows you need *.lib files for -l and *.dll at runtime. So, you -l are wrong.
-
@Vijaykarthikeyan What @JonB means is that on Windows you need *.lib files for -l and *.dll at runtime. So, you -l are wrong.
@jsulm yes ofcourse lib for static and dll for runtime..but how to correclty link the .dll file in .pro..please someone guide me
-
@jsulm yes ofcourse lib for static and dll for runtime..but how to correclty link the .dll file in .pro..please someone guide me
@Vijaykarthikeyan said in OpenCV error:
yes ofcourse lib for static and dll for runtime
NO! You're not using static libs!
Again: you do not link dll files, you link lib files:-lNAME_OF_THE_LIB.lib
When deploying the app you deploy dll files. Please read the link I gave you. And also https://doc.qt.io/qt-6/windows-deployment.html
-
@jsulm yes ofcourse lib for static and dll for runtime..but how to correclty link the .dll file in .pro..please someone guide me
@Vijaykarthikeyan said in OpenCV error:
but how to correclty link the .dll file in .pro..please someone guide me
You don't link to
.dll
files. You don't mention.dll
files in a.pro
file. You need to stick to examples, they don't.
OK, I think I see, they name the library fileslib....dll.a.
I don't use Windows/MinGW, is it supposed to be-lopencv....dll
? Without the leadinglib
?
But if your code links fine with what you have in the.pro
file that's fine.-lNAME_OF_THE_LIB.lib
I think we are talking MinGW not MSVC here?
lib....a
files.At runtime your program has to find
libopen....dll
file. That needs to be in the same directory as the executable or specified inPATH
. I think yours is not? Where islibopencv_....dll
per error message, I only seelibopencv....dll.a
? -
@Vijaykarthikeyan said in OpenCV error:
but how to correclty link the .dll file in .pro..please someone guide me
You don't link to
.dll
files. You don't mention.dll
files in a.pro
file. You need to stick to examples, they don't.
OK, I think I see, they name the library fileslib....dll.a.
I don't use Windows/MinGW, is it supposed to be-lopencv....dll
? Without the leadinglib
?
But if your code links fine with what you have in the.pro
file that's fine.-lNAME_OF_THE_LIB.lib
I think we are talking MinGW not MSVC here?
lib....a
files.At runtime your program has to find
libopen....dll
file. That needs to be in the same directory as the executable or specified inPATH
. I think yours is not? Where islibopencv_....dll
per error message, I only seelibopencv....dll.a
?@JonB you're absolutely correct..Thanks for clarifying me.Actually,For the previous projects using opencv..i have included one line which I'm missing in this that's why error hits.
Actually when linking third party libraries against to Qt..we must include it's path to qmake flags.
So, we must include this:
# Add the include path to QMAKE_CXXFLAGS QMAKE_CXXFLAGS += -I$$PWD/C:/opencv2/include
-
@JonB you're absolutely correct..Thanks for clarifying me.Actually,For the previous projects using opencv..i have included one line which I'm missing in this that's why error hits.
Actually when linking third party libraries against to Qt..we must include it's path to qmake flags.
So, we must include this:
# Add the include path to QMAKE_CXXFLAGS QMAKE_CXXFLAGS += -I$$PWD/C:/opencv2/include
@Vijaykarthikeyan said in OpenCV error:
QMAKE_CXXFLAGS += -I$$PWD/C:/opencv2/include
This is actually done using INCLUDEPATH in pro file
-
@Vijaykarthikeyan said in OpenCV error:
QMAKE_CXXFLAGS += -I$$PWD/C:/opencv2/include
This is actually done using INCLUDEPATH in pro file
@jsulm so like this:
INCLUDEPATH += -I$$PWD/C:/opencv2/include -
@jsulm so like this:
INCLUDEPATH += -I$$PWD/C:/opencv2/include@Vijaykarthikeyan No, like shown in the documentation and the screenshot you posted: https://doc.qt.io/qt-6/qmake-variable-reference.html#includepath
-
@Vijaykarthikeyan No, like shown in the documentation and the screenshot you posted: https://doc.qt.io/qt-6/qmake-variable-reference.html#includepath
@jsulm oh..yes..NOw I understood..Thank you
-