I have created an application in Qt 6.5 in which I create a connection via WiFi to the camera mounted on an Elegoo robot. To use OpenCV 4.6.0 libraries (which I compiled in dll and debug version), in project file I have:

Qt Code:
  1. QT += core gui network
  2.  
  3. greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
  4.  
  5. CONFIG += c++17
  6.  
  7. # You can make your code fail to compile if it uses deprecated APIs.
  8. # In order to do so, uncomment the following line.
  9. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
  10.  
  11. SOURCES += \
  12. main.cpp \
  13. mainwindow.cpp
  14.  
  15. HEADERS += \
  16. mainwindow.h
  17.  
  18. FORMS += \
  19. mainwindow.ui
  20.  
  21. INCLUDEPATH +=D:\\OpenCV\\build\\include
  22.  
  23. LIBS +=-LD:\\OpenCV\\mybuild\\lib\\Debug \
  24. -lopencv_calib3d470d \
  25. -lopencv_core470d \
  26. -lopencv_dnn470d \
  27. -lopencv_features2d470d \
  28. -lopencv_flann470d \
  29. -lopencv_gapi470d \
  30. -lopencv_highgui470d \
  31. -lopencv_imgcodecs470d \
  32. -lopencv_imgproc470d \
  33. -lopencv_ml470d \
  34. -lopencv_objdetect470d \
  35. -lopencv_photo470d \
  36. -lopencv_stitching470d \
  37. -lopencv_ts470d \
  38. -lopencv_video470d \
  39. -lopencv_videoio470d
To copy to clipboard, switch view to plain text mode 
In the static version of OpenCV, it means having the .a libraries to put in -lopencv_...d (in the debug version).