I’ve been searching for the answer and read about 10 thread with similar problems, but have not been able to fix my problem.
Error 2 error C2065: ‘threadIdx’ : undeclared identifier c:\users\craig\appdata\local\nvidia corporation\nvidia gpu computing sdk\c\src\particleengine\ParticleEngine.cu 6 cuParticleEngine
I get 7 errors total. All just like that one but with blockIdx etc.
I created my Visual Studio project file using the template file provided and have renamed some of the files.
I originally wrote the program as a console application using all CPU. I copied the files into my new project, and it compiled and ran fine (though at about half the FPS). Now I’m trying to add my CUDA function, and I’m getting these errors.
These are my files:
ParticleEngine.h
ParticleEngine.cpp (holds the particle engine class)
ParticleEngine.cu (holds CUDA accelerated code, the one throwing the errors)
template.cu (holds main code)
template_gold.cpp (included by default)
template_kernel.cu(included by default)
I tried removing ParticleEngine.cu and re-adding it, and it told me there were no build rules for .cu files, and asked if I wanted to make a custom build rule.
Here is the beginning of my ParticleEngine.cu file
#include <cutil_inline.h>
#include <math.h>
__global__ void cuUpdateParticles(PARTICLES*particles, bool mousePressed, int mouseX, int mouseY,
float mouseForce, float gravity, float boxHeight, float boxWidth)
{