Reputation: 41
I was wondering if anyone can help with this error I'm getting in Cuda code. I want to define the function but it's saying that this declaration has no storage class or type specifier. Anyone know what should I do? This is a link to the screenshot of the error.
Upvotes: 0
Views: 689
Reputation: 131547
As @RobertCrovella explains, this is just your IDE not being aware of CUDA keywords when parsing your source.
Something you could do is make your parser find a
#define __device__
line, which would make it stop complaining. The problem is, you want the CUDA compiler not to hit this #define
. So you can put it within an #ifdef
, like so:
#ifdef __CUDACC__
#define __device__
#endif
which does the trick.
Of course, this only handles one keyword, __device__
. You would need to have similar definitions for all CUDA keywords, as well as types and functions which are implicitly defined.
Upvotes: 1