Cuda: error C2065:"threadIdx':undeclared identifier

Hi all,

I am trying to create a Cuda project in VisualStudio 2010.I have created one simple test .cu file which take an array and add 1 to all its element and send 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.
Also I am using CUDA 4.2.I have selected the Cuda 4.2 in the Build Customization option by right clicking on the project.

But when I tried to compile it,firstly it gave two errors .

1)error C2065 :‘threadIdx’: undeclared identifier 2)error C2059: syntax error:’<’

Then in some Nvidia post ,somebody mentioned to change the Item Type of.cu file to CUDA C/C++.But after doing this it give two more errors:

3)error D8003: missing source filename …\Visual Studio 2010\Projects\MyFirstKernel\MyFirstKernel\cl

4)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:\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” “…\Visual Studio 2010\Projects\MyFirstKernel\MyFirstKernel\test.cu”” exited with code 2. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\CUDA 4.2.targets

Please help me to figure out the issue…

Thanks in advance.

-Gill