Repository: opencv
Issue: [Build OpenCV4.8.0] LNK2005 redefinition error when building highgui plugin
Labels: bug,category: highgui-gui,platform: win32

### System Information

OpenCV version: 4.8.0
Operating System / Platform: Windows11
Compiler & compiler version: MSVC2022

### Detailed description

Build failure: LNK2005 redefinition error when building highgui plugin

### Steps to reproduce

Options:
```
          -D CMAKE_TOOLCHAIN_FILE="${vcpkgPath}/scripts/buildsystems/vcpkg.cmake" `
          -D VCPKG_TARGET_TRIPLET="x64-windows-static" `
          -D VCPKG_TRACE_FIND_PACKAGE=OFF `
          -D VCPKG_VERBOSE=ON `
          `
          -D BUILD_WEBP=OFF `
          -D WITH_QT=ON `
          -D VIDEOIO_PLUGIN_LIST="all" `
          -D HIGHGUI_PLUGIN_LIST="all" `
         `
          -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules `
          -D BUILD_SHARED_LIBS=OFF ../opencv
```

Failure log:
```
Build started...
1>------ Build started: Project: opencv_highgui_win32, Configuration: Debug x64 ------
1>opencv_highgui480d.lib(window_QT.obj) : error LNK2005: cvCreateTrackbar already defined in window_w32.obj
1>opencv_highgui480d.lib(window_QT.obj) : error LNK2005: cvCreateTrackbar2 already defined in window_w32.obj
1>opencv_highgui480d.lib(window_QT.obj) : error LNK2005: cvDestroyAllWindows already defined in window_w32.obj
1>opencv_highgui480d.lib(window_QT.obj) : error LNK2005: cvDestroyWindow already defined in window_w32.obj
1>opencv_highgui480d.lib(window_QT.obj) : error LNK2005: cvGetTrackbarPos already defined in window_w32.obj
1>opencv_highgui480d.lib(window_QT.obj) : error LNK2005: cvGetWindowHandle already defined in window_w32.obj
1>opencv_highgui480d.lib(window_QT.obj) : error LNK2005: cvGetWindowName already defined in window_w32.obj
1>opencv_highgui480d.lib(window_QT.obj) : error LNK2005: cvInitSystem already defined in window_w32.obj
1>opencv_highgui480d.lib(window_QT.obj) : error LNK2005: cvMoveWindow already defined in window_w32.obj
1>opencv_highgui480d.lib(window_QT.obj) : error LNK2005: cvNamedWindow already defined in window_w32.obj
1>opencv_highgui480d.lib(window_QT.obj) : error LNK2005: cvResizeWindow already defined in window_w32.obj
1>opencv_highgui480d.lib(window_QT.obj) : error LNK2005: cvSetMouseCallback already defined in window_w32.obj
1>opencv_highgui480d.lib(window_QT.obj) : error LNK2005: cvSetTrackbarMax already defined in window_w32.obj
1>opencv_highgui480d.lib(window_QT.obj) : error LNK2005: cvSetTrackbarMin already defined in window_w32.obj
1>opencv_highgui480d.lib(window_QT.obj) : error LNK2005: cvSetTrackbarPos already defined in window_w32.obj
1>opencv_highgui480d.lib(window_QT.obj) : error LNK2005: cvShowImage already defined in window_w32.obj
1>opencv_highgui480d.lib(window_QT.obj) : error LNK2005: cvStartWindowThread already defined in window_w32.obj
1>opencv_highgui480d.lib(window_QT.obj) : error LNK2005: cvWaitKey already defined in window_w32.obj
1>   Creating library E:/Build/opencv/build_win_x64_static/lib/Debug/opencv_highgui_win32480_64d.lib and object E:/Build/opencv/build_win_x64_static/lib/Debug/opencv_highgui_win32480_64d.exp
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>libwebp.lib(picture_csp_enc.c.obj) : error LNK2019: unresolved external symbol SharpYuvConvert referenced in function ImportYUVAFromRGBA
1>libwebp.lib(picture_csp_enc.c.obj) : error LNK2019: unresolved external symbol SharpYuvGetConversionMatrix referenced in function ImportYUVAFromRGBA
1>libwebp.lib(picture_csp_enc.c.obj) : error LNK2019: unresolved external symbol SharpYuvInit referenced in function ImportYUVAFromRGBA
1>E:\Build\opencv\build_win_x64_static\bin\Debug\opencv_highgui_win32480_64d.dll : fatal error LNK1120: 3 unresolved externals
1>Done building project "opencv_highgui_win32.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 90 up-to-date, 0 skipped ==========
========== Build started at 8:51 PM and took 21.114 seconds ==========
```

### Issue submission checklist

- [X] I report the issue, it's not a question
- [X] I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- [X] I updated to the latest OpenCV version and the issue is still there
- [X] There is reproducer code and related data files (videos, images, onnx, etc)