I am trying to build a C++ OpenCV application with CMake, I checked the options for the OpenCV config but can not find the WITH_QT option, so i am confused if I can build a OpenCV 4.11.0 application with Qt GUI interface using Qt 6.8.1
are you trying to build your own program, or are you trying to build the OpenCV library itself?
the WITH_QT
option applies to building OpenCV itself. that will cause Qt to be available as a backend to highgui
, i.e. cv::imshow()
.
If you want to use Qt itself in your own program, follow any steps involved in using Qt in any arbitrary C++ program. This does not involve OpenCV.
Thanks for your reply. I decided to build OpenCV form sources with the WITH_QT option on but I got this error which I don’t understand
Error
[build] Building Java objects for opencv_java_jar.jar
[build] CUSTOMBUILD : error : invalid flag: C:/Users/BIZZ/Downloads/programs/opencv/sources/build/MSVC [C:\Users\BIZZ\Downloads\programs\opencv\sources\build\MSVC Debug\modules\java\jar\opencv_java_jar.vcxproj]
[build] Usage: javac <options> <source files>
[build] use --help for a list of possible options
[build] C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for 'C:\Users\BIZZ\Downloads\programs\opencv\sources\build\MSVC Debug\CMakeFiles\ad1f439dca0c4c8a600ca183ac6392a2\java_compiled_opencv_java_jar.rule;C:\Users\BIZZ\Downloads\programs\opencv\sources\build\MSVC Debug\CMakeFiles\ad1f439dca0c4c8a600ca183ac6392a2\java_class_filelist.rule;C:\Users\BIZZ\Downloads\programs\opencv\sources\build\MSVC Debug\CMakeFiles\f4f2a0ebc979168bf8b7789caa8161f3\opencv-4110.jar.rule;C:\Users\BIZZ\Downloads\programs\opencv\sources\build\MSVC Debug\CMakeFiles\33546c983e7a5377b661d637ff100f5e\opencv_java_jar.rule' exited with code 2. [C:\Users\BIZZ\Downloads\programs\opencv\sources\build\MSVC Debug\modules\java\jar\opencv_java_jar.vcxproj]
now that’s something entirely different. that’s related to building the OpenCV package for java.
if you don’t want that, don’t enable it.