JoshJoshJosh
JoshJoshJosh

Reputation: 917

Visual Studio 2017 with CUDA cannot open include file 'cuda.h'

I am working on the Nvidia SDK with Visual Studio and I have been running into the error of this whenever I am trying to compile the sample from Nvidia:

Severity Code Description Project File Line Suppression State Error C1083 Cannot open include file: 'cuda.h': No such file or directory AppDecPerf
c:\users\administrator\desktop\video_codec_sdk_8.1.24\samples\appdecode\appdecperf\appdecperf.cpp 12

I do have CUDA installed on my computer and it looks like I have to link it with the IDE somehow but I just cannot find 'cuda.h' file anywhere.

Any help is appreciated. Thanks!

Upvotes: 4

Views: 8924

Answers (2)

Mark Ingram
Mark Ingram

Reputation: 73713

Right click your project, choose Build Dependencies then Build Customizations. From here you can choose the version of the CUDA Toolkit that you'd like to work with (amongst other things it will add the $(CudaToolkitDir) variable, and a new CUDA C/C++ tab to the project properties). The samples from NVIDIA should already be configured this way, but I've noticed that they can break when upgrading the SDK.

Further details are available here: https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html#build-customizations-for-existing-projects

Upvotes: 2

ObliteratedJillo
ObliteratedJillo

Reputation: 5166

Install cuda library( static or dynamic) for Windows in vc++ 2017 using vcpkg.exe. Use .\vcpkg integrate install to automatically link the project to your solution.

Use .\vcpkg install cuda:x64-windows-static to install.

Upvotes: 2

Related Questions