Opencv.sln cannot be built, path length limit

Hello,

I have used opencv460 and opencv_contrib460 and build the .sln file with CUDA support on windows machine. Now I am trying to build the opencv.sln file in (Release x64) mode, however I am encountering following error.

Schweregrad Code Beschreibung Projekt Datei Zeile Unterdrückungszustand
Fehler MSB4023 Elementmetadaten %(RootDir) können nicht ausgewertet werden. Die %(FullPath)-Elementmetadaten können nicht auf den Pfad C:\Users\FFT_Xarion\Downloads\opencv460\opencv-4.6.0\opencv-4.6.0\release\modules\world\CMakeFiles\cuda_compile_1.dir____\opencv_contrib-4.6.0\opencv_contrib-4.6.0\modules\cudafilters\src\cuda\Release\cuda_compile_1_generated_column_filter.16sc1.cu.obj angewendet werden. Der Pfad C:\Users\FFT_Xarion\Downloads\opencv460\opencv-4.6.0\opencv-4.6.0\release\modules\world\CMakeFiles\cuda_compile_1.dir____\opencv_contrib-4.6.0\opencv_contrib-4.6.0\modules\cudafilters\src\cuda\Release\cuda_compile_1_generated_column_filter.16sc1.cu.obj überschreitet das maximale Pfadlimit des Betriebssystems. Der vollqualifizierte Dateiname muss weniger als 260 Zeichen umfassen. opencv_world E:\IDE\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets 1164

It looked like the path is too long so I have shifted the code (opencv and opencv_contrib) to shorter path directory. This didnt help too because it is still using the same path, i am not sure how can I change it? Or is it the real problem?

thanks

So the problem is now solved using the recommendation below:)

I just want to clear another point. I have chosen x64 built and it had succedded too but when i go inside x64\Release\ i dont find any dlls. then i cme back to build directory then i navigated to bin\Release i did found a very few dll (opencv_videoio_ffmpeg460_64) nothing else. Where can i find the built dlls?

I have checked build_opencv_world too.

If it is still using the same path then you need to clean the build directory and configure/generate the solution file with cmake again.

If I were you I would use ninja to build because Visual Studio is slow when building OpenCV with CUDA.

set HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled to DWORD:1

2 Likes