Error in a simple cuda compilation

Viewed 17787

FSPB_main.cpp

int main(int args, char* argv[]){    
    .......   

   float *d_a;   
   cudaMalloc( (void**)&d_a, 5*sizeof(float) );

}

$ nvcc -L/usr/local/cuda/lib -lcutil -lcudpp -lcuda -lcudart -c -o FSPB_main.o FSPB_main.cpp

FSPB_main.cpp: In function ‘int main(int, char**)’: FSPB_main.cpp:167:45: error: ‘cudaMalloc’ was not declared in this scope

What does this error mean? It's just a cudaMalloc and it suppose to be supported for the compiler right?

Can functions like cudaMalloc be used in a .cpp file? Do I need to create a .cu file just for anything what comes from CUDA?

1 Answers
Related