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>
?
In Visual Studio 2008, add the path of the include files in Visual C++ directories.
"Installation Path"\NVIDIA GPU Computing Toolkit\CUDA\"version"\include\
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.
Instead of setting up a hard-coded path - which you will most likely have when locating CUDA installation on your machine - you can also add cudart.lib
as additional dependency for the linker.
Right click on the project > Properties > Linker > Input > Additional Dependencies. Add cudart.lib
there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With