How to include <cuda_runtime.h> in .cpp file

cuda, visual-studio

Solution

In Visual Studio 2008, add the path of the include files in Visual C++ directories.

"Installation Path"\NVIDIA GPU Computing Toolkit\CUDA\"version"\include\

Here is the procedure:

In Visual Studio 2008, go to - Tools -> Options -> Projects And Solutions -> Visual C++ Directories. - Select include files from the drop down list named "Show Directories For". - Add new item by clicking the yellow button below the drop down list. - Paste the include fles path here. - Verify the correctness of path by clicking the check button on left of yellow button - Click ok and restart visual studio.

Now Visual Studio 2008 will know where the include file is located.

Problem

I have problem to include `<cuda_runtime.h>` in `.cpp` file. Error: `Cannot include file: cuda_runtime.h: No such file or directory`. I am trying to complie code from Rob Farber ( http://www.drdobbs.com/architecture-and-design/222600097?pgno=1 ). I have compiled few cuda codes before but `<cuda_runtime.h>` was allways included in `.cu` file. I am using VS 2008 Express. Q: Do I have to link VS somehow different so it knows where to look for `<cuda_runtime.h>`?

Original source