kernel<<<1,1>>>(); error C2059: syntax error : '<'

I am extremely new to programming. I have some experience in C++, Java and C#. I am trying to learn Cuda since my professor asked me to learn it before I start doing research with him next semester. My problem is; i cant seem to even get basic “hello world” program running in cuda code. I have tried searching the net, but it seems the posts either don’t pertain to my issue, or the issue is buried in programs that are beyond my level.

I am using VS 2010. I have installed the Cuda took kit.
Below is everything i have in the .cpp file.


using namespace std;

global void kernel( void ){}
int main (void){
kernel<<<1,1>>>(); //i underlined where vs indicates the problem.
printf(“hello, world!/n”);
return 0;

any help on what i seem to be doing wrong would be much appreciated.

Rename the file to a .cu extension. nvcc uses the file extension as a first indication of whether to parse an input file looking for CUDA device code and host syntax, or send it intact to the host compiler. If you use .cc or .ccp, it will assume there is no CUDA content and not try to process it.

Thank you so much, you are my new hero. I still get the error: expected and expression.But, it compiles.

Thanks again.

Dear friends:
Have you resolve the problem. I met the same trouble with you. I can not figure it out.

Yes, he has. Read the two posts above yours.