problem with class template


I am student , i use class template in my project , i write a device kernel which has code like that:

device host inline Paddle* INDIVIDUAL_ACCESS(void* buffer,size_t id){
return (Paddle*)buffer+id;

My problem is that i have an error in the line of the return function in the cuda file which is:

error: expression must be a pointer to a complete object type

But when i use the same kernel in the cpp file , i haven’t any error,

I need this kernel in the cuda file , can any one help me.

THanks a lot


Most likely it “doesn’t see” Paddle class definition, when compiling the kernel
Check for #include “Paddle.h” in your .cu file.

bw, Anatoly


Thanks a lot , in reality i have many problem in the cuda file because when i include some header files , the nvcc generate errors that other inlude files dosen’t exist. to avoid this i use another header file where i put #include “paddle.h”. the name file is #include “calcFitnessIndividual.h” and his code is like that:

#include <cuda.h>
#include <cuda_runtime_api.h>
#include <cuda_runtime.h>
#include <stdio.h>
#include “constants.h”

#include “organisms/organism.h”
#include “organisms/paddle.h”

template class Paddle;
template class Paddle;

extern “C” void calcfitnesspopulation(void* population);

I want to note that this include file is included in my cuda file, but i think that is not visible in the .cu.

Thanks a lot for any help


I forgot to note that the same kernel doesn’t have any error when i put it in the cpp file .