Can someone help me?

Hi everyone,
I am a new guy to CUDA,I met some problems that I cann’t solve .I want to make a probject in one function so it is convient to use.

I try to duplicate the “eigenvalues” project to realize a “+1” function.

1.main.cu
#include <stdlib.h>
#include <stdio.h>
#include <cutil.h>

#include “test.cuh”

int
main( int argc, char** argv)
{
float a[10]={1,1,1,1,1,2,2,2,2,2};

int i;
printf("before deal with CUDA:\n");
for (i=0;i<10;i++)
{
	printf("%f\t",a[i]);
}

addline(a);


printf("\nafter deal with CUDA\n");
for (i=0;i<10;i++)
{
	printf("%f\t",a[i]);
}
return 1;

}

2.test.cuh
void addline(float * a);

3.test.cu
#include <test_kernel.cu>

void addline(float * a)
{

float *device;

CUDA_SAFE_CALL(cudaMalloc((void**)&device,10*sizeof(float)));
CUDA_SAFE_CALL(cudaMemcpy(device,a,sizeof(float) *10,cudaMemcpyHostToDevice));


addkernel<<<1,10>>>(a,device);
CUDA_SAFE_CALL(cudaMemcpy(a,device,10*sizeof(float),cudaMemcpyDeviceToHost));

}

4.test_kernel.cu
#include <stdlib.h>
#include <stdio.h>
#include <cutil.h>
#include <cuda_runtime.h>

global void addkernel(float *a,float *device)

{
device[threadIdx.y]=device[threadIdx.y]+1;
}

The information complier gives :
1>.\test_kernel.cu(9) : error C2065: ‘threadIdx’ : undeclared identifier
1>.\test_kernel.cu(9) : error C2228: left of ‘.y’ must have class/struct/union
1> type is ‘‘unknown-type’’
1>.\test_kernel.cu(9) : error C2228: left of ‘.y’ must have class/struct/union
1> type is ‘‘unknown-type’’
1>test.cu
1>test_kernel.cu(9) : error C2065: ‘threadIdx’ : undeclared identifier
1>test_kernel.cu(9) : error C2228: left of ‘.y’ must have class/struct/union
1> type is ‘‘unknown-type’’
1>test_kernel.cu(9) : error C2228: left of ‘.y’ must have class/struct/union
1> type is ‘‘unknown-type’’
1>.\test.cu(12) : error C2059: syntax error : ‘<’

Hope for someone’s help,thank you very much!!!

How are you compiling it?
You cant just use visual studio. You need to use nvcc.

I use visul studio 2005.

I have finished a small project in CUDA yet.It works well.

And when I define a constant variable in the kernel file.The .cu file could find the variable and there are no problems.

I solve this problem.If some else have a same question ,he can send me mail.^_^

It confused me so much …

How exactly did you solve this problem? I’m experiencing the same…

Yeah, you should at least put a few words hinting to what was wrong. Hundreds of people will read this thread. Plus I’m not sure our emails will get to you, seeing as how they’ll be crowded out by all the spam you must receive publishing your email like that. >.<