Inheritance and class in cuda

Hello,

I try to inherit a class in my cuda class. Here is my mother class:

class BB
{

public:
    BB(int iwidth,int iheight)
    {}
    ~BB()
    {}

};


class BBCPU:public BB
{

public:
    BBCPU(int iwidth,int iheight):
        BB(iwidth,iheight)
    {
    };

    ~BBCPU()
    {}

};



class BBGPU:public BB
{

public:
    BBGPU(int iwidth,int iheight):
        BB(iwidth,iheight)
    {
    }

    ~BBGPU()
    {

    }

};

Here is the code where I use this header file:

BBProd.h:

#include "../include/BB.h"

namespace gpu {
class BBGPU_Prod:public BBGPU
{

public:
    BBGPU_Prod(int iwidth,int iheight);

    ~BBGPU_Prod();

};


}

And my cu file:

#include "BB.h"


namespace gpu {

BBGPU_Prod::BBGPU_Prod(int iwidth,int iheight):
    BBGPU(iwidth,iheight)
{


}

BBGPU_Prod::~BBGPU_Prod()
{
    // free device memory

    std::cout << "Destroy BBGPU_Prod  " << std::endl;
}

And the compilation result send me that:

BB_cuda.o : Dans la fonction « __sti____cudaRegisterAll_58_tmpxft_0000729b_00000000_10_BB_compute_52_cpp1_ii_cfe1355d() » :
tmpxft_0000729b_00000000-7_BB.compute_50.cudafe1.cpp:(.text+0x127) : référence indéfinie vers « __cudaRegisterLinkedBinary_58_tmpxft_0000729b_00000000_10_BB_compute_52_cpp1_ii_cfe1355d »
Makefile:261 : la recette pour la cible « Prog » a échouée
collect2: error: ld returned 1 exit status
make: *** [Prog] Erreur 1
11:12:27: Le processus "/usr/bin/make" s'est terminé avec le code 2.
Erreur lors de la compilation/déploiement du projet Prog (kit : Desktop Qt 5.7.0 GCC 64bit)
When executing step "Make"
11:12:27: Temps écoulé : 00:37.

I don’t understand why this append.

class BB {
public:
  BB(int iwidth,int iheight) {}
  ~BB() {}
};

class BBCPU:public BB {
public:
  BBCPU(int iwidth,int iheight): BB(iwidth,iheight) {}
  ~BBCPU() {}
};

class BBGPU:public BB {
public:
  BBGPU(int iwidth,int iheight): BB(iwidth,iheight) {}
  ~BBGPU() {}
};

#include <iostream>

namespace gpu {

  class BBGPU_Prod:public BBGPU {
  public:
    BBGPU_Prod(int iwidth,int iheight);
    ~BBGPU_Prod();
  };

}

namespace gpu {

  BBGPU_Prod::BBGPU_Prod(int iwidth,int iheight): BBGPU(iwidth,iheight) {}
  BBGPU_Prod::~BBGPU_Prod() {
    // free device memory
    std::cout << "Destroy BBGPU_Prod  " << std::endl;
  }

}

int main() {
  gpu::BBGPU_Prod object(0,0);
}

hmmm… can’t be re-produced on Windows7(x64)/Visual C++ 2015 update-1/CUDA 8.0

E:\work>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Sat_Sep__3_19:05:48_CDT_2016
Cuda compilation tools, release 8.0, V8.0.44

E:\work>nvcc -Xcompiler -wd4819 BB_cuda.cu
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecat
ed, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to s
uppress warning).
BB_cuda.cu
   ライブラリ a.lib とオブジェクト a.exp を作成中

E:\work>a.exe
Destroy BBGPU_Prod