cudaGetLastError not working with SDK 3.1

Just installed SDK 3.1

This code was OK with previous releases,

cudaError_t err = cudaGetLastError();

   if( cudaSuccess != err) 

   printf( "Cuda error: %s.\n",  cudaGetErrorString( err) );

now, it prints this all the time

Cuda error: duplicate global variable looked up by string name

Any idea why?

Because you have a global variable (maybe a texture) that uses the same name in multiple compilation units. Don’t do that because it breaks CUDART in a really bad way (and always had, you were probably just getting lucky before).

Because you have a global variable (maybe a texture) that uses the same name in multiple compilation units. Don’t do that because it breaks CUDART in a really bad way (and always had, you were probably just getting lucky before).

That is strange because when I remove the checkerror call, the program runs fine without hickups.
I did not find this error message in the enum error types in the new reference manual.
I like to chose my variable names as freely as I can.

That is strange because when I remove the checkerror call, the program runs fine without hickups.
I did not find this error message in the enum error types in the new reference manual.
I like to chose my variable names as freely as I can.

I read the manual.
The simple solution is to add the keyword static in front of every device definition.

I read the manual.
The simple solution is to add the keyword static in front of every device definition.

It is not enough to add static in front of all device calls.
You have to eliminate the real duplicate variables left in your functions.
I did not ran my program for a long time enough to find that there was another duplicated variable left despite the static attribute.
It would help a lot if the message would point to the faulty variable.

It is not enough to add static in front of all device calls.
You have to eliminate the real duplicate variables left in your functions.
I did not ran my program for a long time enough to find that there was another duplicated variable left despite the static attribute.
It would help a lot if the message would point to the faulty variable.