nvcc doesn't like __shared__ incomplete type not allowed.

I have one shared array just like the programming guide says to do, but when I compile it barfs. Is there an option I’m missing or what? This seems to be something pretty big for it to be a compiler bug, so I have to be missing something

error: incomplete type is not allowed
attribute((shared)) RayStruct shared;

Any help is appreciated.

::SOLVED::
Needed to add extern keyword.

Was it an Cpp or C file then? because I don’t think you need to do that in .cu

Next time it’s a good idea to tell where this happens.

@Ninkazu,

It would be a better idea to add a reply and say “SOLVED” instead of editing the original note. :wave:

I have an addendum to this problem. Now that I have everything else working, when I try to set a value in shared memory, the execution stops and I get a message “Aborted (core dumped)”. Anyone else get this problem?
Really shared[0].orig[0] = 0.f is enough to make it abort (orig is a float[3] in RayStruct).

I’m kinda lost, maybe it is better to post some parts of your code, because this is something we cannot do allot about.

Are you allocating your shared memory in the kernel call? I.e. in kernel<<<blocks, threads, shared>>>() is shared set to the correct number of bytes for the amount of shared memory you will use in each block?

That did the trick. Thanks.