使用CUDA的Visual Studio 2017无法打开包含文件'cuda.h'

时间:2018-04-24 02:32:42

标签: c++ visual-studio cuda

我正在使用Visual Studio处理Nvidia SDK,每当我尝试从Nvidia编译样本时,我都遇到了错误:

严重级代码描述项目文件行抑制状态  错误C1083无法打开包含文件:'cuda.h':没有这样的文件或 目录AppDecPerf
 c:\ users \ administrator \ desktop \ video_codec_sdk_8.1.24 \ samples \ appdecode \ appdecperf \ appdecperf.cpp 12

我的计算机上安装了CUDA,看起来我必须以某种方式将它与IDE链接,但我无法在任何地方找到'cuda.h'文件。

感谢任何帮助。谢谢!

2 个答案:

答案 0 :(得分:1)

使用vcpkg.exe在vc ++ 2017中为Windows安装cuda库(静态或动态)。使用.\vcpkg install cuda:x64-windows-static自动将项目链接到您的解决方案。

使用if(bucket.upload(params, function (err, data) { ... model.picture = data.Location; //this.model.picture = data.Location; also try this ... })){ return file.name } 进行安装。

答案 1 :(得分:0)

右键单击您的项目,选择Build Dependencies,然后选择Build Customizations。在这里,您可以选择要使用的CUDA工具包的版本(此外,它还将在项目属性中添加$(CudaToolkitDir)变量和新的CUDA C/C++标签)。 NVIDIA的样本应该已经用这种方式配置,但是我注意到升级SDK时它们可能会损坏。

更多详细信息在这里: https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html#build-customizations-for-existing-projects