OpenCV error
-
wrote on 8 Jan 2024, 11:34 last edited by
-
@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
?wrote on 9 Jan 2024, 05:39 last edited by Vijaykarthikeyan 1 Sept 2024, 05:40@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
wrote on 8 Jan 2024, 14:04 last edited byalready 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
wrote on 8 Jan 2024, 14:18 last edited by@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.wrote on 8 Jan 2024, 14:22 last edited byi 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.
wrote on 8 Jan 2024, 14:40 last edited by@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
wrote on 8 Jan 2024, 14:54 last edited by JonB 1 Aug 2024, 15:02@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
?wrote on 9 Jan 2024, 05:39 last edited by Vijaykarthikeyan 1 Sept 2024, 05:40@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
wrote on 9 Jan 2024, 07:24 last edited by@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
wrote on 9 Jan 2024, 07:30 last edited by@jsulm oh..yes..NOw I understood..Thank you
-
1/15