Cuda: error C2065:"threadIdx':undeclared identifier

Solution 1:

If you are annoyed by the IDE errors (which still lets your code work without errors) just like I was, try to do plain text search in the SDK`s include folder for the (seemingly) undefined symbols and you will find the right header to include in no time. "threadIdx" for example resides in "device_launch_parameters.h" header file.

Solution 2:

The errors you get most likely indicate that you're not compiling your CUDA sources with NVCC. Make sure that you are, either by selecting the appropriate item type (CUDA C/C++) if you have installed the Visual Studio integration when installing the toolkit. Or make sure you have set up appropriate build rules for your sources.