Error: linkage specification is incompatible - Can anyone help Beginners doubts

Hi all,

I am just getting started with CUDA. I just managed to integerate CUDA into Microsoft VC++ 2005. And when i tried running my first CUDA program I got stuck with an error. I am not able to figure this out. Can anybody help please.

[codebox]cudaError_t cudaMalloc(void** dev_ptr, size_t size);[/codebox]

For the above code I am getting the error message “Error: Linkage specification is incompatible with previous cudaMalloc”. What does this mean?

When I try to compile without the ‘cudaError_t’, I get two error messages “Error: type name is not allowed” and "Error: expected a ‘)’ " both errors on the same line.

In my code dev_ptr is a pointer to an integer (the first element of an array) and size=sizeof(array). Where am I going wrong? I am running this on an emulator, in case that is relevant.

thanks in advance for any help,

Avinash

Uh… you’re not even calling cudaMalloc correctly as a C function. If you don’t know it now, you really should learn C before you dive into CUDA.