c++ - CUDA: __device__ and __global__ error: expected constructor, destructor, or type conversion before "unsigned"/"void"" -
so problem is: i'm using nvidia's nsight application on mac os x mountain lion write cuda application: source code .h/.cu/.cpp mix.
i have hellocuda.h header following declarations:
//yep, both taken examples. __device__ unsigned int bitreverse2(unsigned int number); __global__ void bitreverse(void *data);
and have hellocuda.cu file defines these methods:
__device__ unsigned int bitreverse3(unsigned int number) { //definition return number; } __global__ void bitreverse4(void *data) { //another definition... bitreverse3(idata[threadidx.x]); }
it worked, until added new c++ class files (.h/.cpp) using eclipse's (nsight) new class wizard. now, when try build thing:
../src/hellocuda.h:21: error: expected constructor, destructor, or type conversion before ‘unsigned’ ../src/hellocuda.h:23: error: expected constructor, destructor, or type conversion before ‘void’
i checked project settings, don't think has changes.
so, gives? could, please, me one?
you created new cpp file using "cuda c bitreverse application" template. template cuda c file. delete file contents , add c++ code instead.
Comments
Post a Comment