OpencvCV doesnt include the right libs in vscode with cmake

I had already dowloaded opencv4.5.3 prebuild packages and include the lib and bin to the system path, but when I try to run the .exe resulted by the debug I receive some erros telling me that opencv_cored.dll, opencv_imgprocd.dll and opencv_highguid.dll were not fund
that’s my cmake file:

cmake_minimum_required(VERSION 3.0.0)
project(opencvtest VERSION 0.1.0)

include(CTest)
enable_testing()

find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS})


add_library(
    CVUI
    cvui.h
    cvui.cpp
)

add_library(
    funcoes
    Funcs.h
    Funcs.cpp
)

add_executable(opencvtest main.cpp)

target_link_libraries( opencvtest ${OpenCV_LIBS}  )
target_link_libraries(opencvtest CVUI)
target_link_libraries(opencvtest funcoes)


set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)

does anyone knows how to solve it?
I’m using the visual studio compiler and the extesion cmake tools of vscode to configure cmake

thanks for your attention and sorry about the bad english

On Windows you have to manually add location of OpenCV DLLs to the PATH environment variable before running the application. Exact method of modifying the environment depends on how you run the application.

1 Like

thanks, now it works