NVIDIA / cuda-samples

Samples for CUDA Developers which demonstrates features in CUDA Toolkit
Other
6.43k stars 1.82k forks source link

All samples fail to load with VS2022 #281

Open tksharpless opened 4 months ago

tksharpless commented 4 months ago

Just cloned and tried to load project "Samples_VS2022.sln". Every single project load fails with the same error message. Example: C:\Users\tksha\cuda-samples\Samples\6_Performance\UnifiedMemoryPerf\UnifiedMemoryPerf_vs2022.vcxproj : error : The imported project "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 12.4.props" was not found. Confirm that the expression in the Import declaration "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 12.4.props" is correct, and that the file exists on disk. C:\Users\tksha\cuda-samples\Samples\6_Performance\UnifiedMemoryPerf\UnifiedMemoryPerf_vs2022.vcxproj The same message appeared in a popup: image

tksharpless commented 4 months ago

My Cuda Toolkit version is 12.5. Evidently the problem is that the vcxproj files all import projects named "CUDA 12.4.xxxx", which don't exist on my system. The corresponding CUDA 12.5 ones do. Unfortunately it is not possible to correct this via the VS IDE; it simply refuses to load the projects.

tksharpless commented 4 months ago

As a quick and dirty workaround I made copies of the 3 files "CUDA 12.5.props", "CUDA 12.5.targets" and "CUDA 12.5.xml" with ".4" in place of ".5". This allowed VS 2022 to load (veerrry slllooowly) and eventually to build the test projects. I strongly suggest you start using cmake to create correct MS projects on the fly. Many benefits would accrue.

na10m commented 4 months ago

I had to uninstall 12.5 and install 12.4, and then it worked for me

visionbike commented 3 months ago

Another solution, you can open *.vcxproj, change "12.4" to "12.5". Then open .sln and build as usual.

booomji commented 2 months ago

Another solution, you can open *.vcxproj, change "12.4" to "12.5". Then open .sln and build as usual.

I tried that. It then complained about not being able to find helper_cuda.h. Cannot open include file: 'helper_cuda.h': No such file or directory

I'm trying to use the 11.8 version.

Thanks for any help b