Torchvision C++ Build Error

HenryZNNUE: <p><strong>Command:</strong><br>
cmake -DCMAKE_PREFIX_PATH=“D:\AI\libtorch;C:\Users\Henry Z\Desktop\VI\Visual Studio\Additional Header Files\pybind11-2.11.1\pybind11;C:\Users\Henry Z\Desktop\VI\Visual Studio\Additional Header Files\lpng1643;C:\libjpeg-turbo64;C:\Users\Henry Z\Desktop\VI\Visual Studio\Additional Header Files\libjpeg;C:\Users\Henry Z\Desktop\VI\Visual Studio\Additional Header Files\zlib;D:\AI\vision-deps” … -DCMAKE_INSTALL_PREFIX=“D:\AI\vision-0.19.0” -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 17 2022" -A x64 -DWITH_CUDA=on …</p>
<p><strong>Output:</strong><br>
– Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.<br>
– The C compiler identification is MSVC 19.41.34120.0<br>
– The CXX compiler identification is MSVC 19.41.34120.0<br>
– Detecting C compiler ABI info<br>
– Detecting C compiler ABI info - done<br>
– Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe - skipped<br>
– Detecting C compile features<br>
– Detecting C compile features - done<br>
– Detecting CXX compiler ABI info<br>
– Detecting CXX compiler ABI info - done<br>
– Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe - skipped<br>
– Detecting CXX compile features<br>
– Detecting CXX compile features - done<br>
– The CUDA compiler identification is NVIDIA 12.4.99<br>
– Detecting CUDA compiler ABI info<br>
– Detecting CUDA compiler ABI info - done<br>
– Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4/bin/nvcc.exe - skipped<br>
– Detecting CUDA compile features<br>
– Detecting CUDA compile features - done<br>
– Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4 (found version “12.4”)<br>
– Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4/include (found version “12.4.99”)<br>
– Caffe2: CUDA detected: 12.4<br>
– Caffe2: CUDA nvcc is: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4/bin/nvcc.exe<br>
– Caffe2: CUDA toolkit directory: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4<br>
– Caffe2: Header version is: 12.4<br>
CMake Warning at D:/AI/libtorch/share/cmake/Caffe2/public/cuda.cmake:153 (message):<br>
Failed to compute shorthash for libnvrtc.so<br>
Call Stack (most recent call first):<br>
D:/AI/libtorch/share/cmake/Caffe2/Caffe2Config.cmake:86 (include)<br>
D:/AI/libtorch/share/cmake/Torch/TorchConfig.cmake:68 (find_package)<br>
CMakeLists.txt:24 (find_package)</p>
<p>– Found CUDNN: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4/lib/x64/cudnn.lib<br>
– USE_CUSPARSELT is set to 0. Compiling without cuSPARSELt support<br>
– Autodetected CUDA architecture(s):  8.9<br>
– Added CUDA NVCC flags for: -gencode;arch=compute_89,code=sm_89<br>
– Found Torch: D:/AI/libtorch/lib/torch.lib<br>
– Found ZLIB: D:/AI/vision-deps/zlib.lib (found version “1.2.11”)<br>
– Found PNG: D:/AI/vision-deps/libpng16.lib (found version “1.6.43”)<br>
– Found JPEG: C:/libjpeg-turbo64/lib/jpeg.lib (found version “62”)<br>
– Configuring done (39.8s)<br>
– Generating done (0.1s)<br>
– Build files have been written to: D:/AI/vision-0.19.0/build</p>
<p>Open torchvision.sln switch to Release, click ‘build’ and get 37 Similar Errors:<br>
|Error|LNK2019 png_write_row，function class at::Tensor __cdecl vision::image::encode_png(class at::Tensor const &amp;,__int64) (?encode_png@image@vision@<span class="mention">@YA</span>?AVTensor@at@<span class="mention">@AEBV34</span>@_J@Z)|torchvision|D:\AI\vision-0.19.0\build\encode_png.obj|1|||</p>
<p>Adding libpng.lib to additional dependencies doesn’t work, can someone help me solve this issue?</p>