NVCC not recognizing __global__ keyword?

I just installed CUDA 2.2, and I am not able to compile kernels apparently… Here is some example code:

#include <cuda.h>

__global__ void test() {

  // do nothing...																								 


int main() {

  test <<<100, 100>>> ();

return 0;


NVCC gives these errors:

$ nvcc example.c 

example.c:3: error: syntax error before ‘void’

example.c: In function ‘main’:

example.c:8: error: syntax error before ‘<’ token

What could be causing this?

Ok, this is a longshot, but try renaming your file to example.cu