cuda defined struct variable error

Hi everyone

i n my cuda code i have a struct like this :

typedef struct {
char tur;
int a;
int b;
dim3 d1, d2;
char message[100];
}mytype_t;

but when i described a local variable (in a global func. ) , in compilation i have this error :

1>d:\projects\cuda\cuda_pro\cuda_pro\kernel.cu(22): error: identifier “_ZN7mytype_tC1Ev” is undefined

but variable declaration consists. i got same problem in both linux and windows compilations of code.

what does this error means and how can i fix it ?

use uint3, which also has three unsigned int

typedef struct {

char tur;

int a;

int b;

uint3 d1, d2;

^^^

char message[100];

}mytype_t;

It means that some C++ name mangling is interfering with your type declaration so it is unrecognizable to the linker. Try declaring it like this

extern "C" {

typedef struct {

char tur;

int a;

int b;

dim3 d1, d2;

char message[100];

}mytype_t;

}

and see whether it makes any difference.