How to run a CUDA program in Visual studio 2010


I have followed every step given in the following link to run a cuda program in Visual Studio 2010 but still I find that the Builder is unable to recognize the global qualifier. Please help me to fix the problem.

The error which I get is something like : “this declaration has no storage class or type specifier”.

This is the code which I tried to run


global void kernel (void)

int main(void)
kernel<<<1, 1>>>();
printf(“Hello World\n”);

return 0;


I compiled your code successfully.

I had no time to go through the youtube presentation. If it may help, you could have a look at the precedure in

I want just to remind you that you have to name the source file as .cu.


Thank you for your reply. I added two more headers <cuda_runtime.h> and <device_launch_parameters.h> and now the compiler is able to identify the global function in the code but another problem which needs to be fixed is that I am getting an error “Expected an expression” for the statement kernel<<<1, 1>>>();

Also I have followed every step to integrate Visual studio with CUDA and neamed the source file with extension .cu

Please help me to rectify the above mentioned error.