I am trying to create a Cuda project in VisualStudio 2010. I have created one simple test .cu file which takes an array and adds 1 to all its element and sends the result back to the host.
I have added cudart.lib file to the Linker.
In the .cu code I have included #include cuda_runtime.h header.
But when I am trying to compile it, it's giving the two errors.
error C2065 :'threadIdx': undeclared identifier
error C2059: syntax error:'<'
After installing Nvidia Nsight Visual Studio edition and setting the item type of .cu file as CUDA C/C++,it starts giving two additional errors:
error D8003:missing source filename
error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\bin\nvcc.exe" -gencode=arch=compute_10,code=\"sm_10,compute_10\" --use-local-env --cl-version 2010 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin" -I"C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.2\C\common\inc" -I"C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.2\shared\inc" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\include" -G --keep-dir "Debug" -maxrregcount=0 --machine 32 --compile -g -Xcompiler "/EHsc /nologo /Od /Zi /MDd " -o "Debug\test.cu.obj" "\ucigrad.local\Users\AGill\My Documents\Visual Studio 2010\Projects\cudatest\cudatest\test.cu"" exited with code 2.
Please help me how to resolve it. I think there may be some issue with nvcc compiler in VS2010 but I'm not able to figure it out.
#include cuda_runtime.hbut your real code has quotes aroundcuda_runtime.h, right? :) - Roger DahlProperty Pages | C/C++ | Command Line. - Roger Dahl