Problem with Destructor

Hi guys

I have a class into my app, some thing like this:

class SwitchPort : public Port
{
      public:  	
        	//Constructor
 		SwitchPort();
 		 SwitchPort(unsigned char local_id, unsigned short parent);
 
 		void Init(unsigned char local_id, unsigned short parent);
		
 		Type_Port Type; //This is an enum
		
 		Neighbor myNeighbor; //this is a class object
		
		  //Destructor
 		~SwitchPort();
}

When I creates and object of type Switchport into the main function the app work fine, but when I creates this object into the kernel, I get the error

The destructor for Switchport and Neighbor are declared as device host.

However, I always im getting this message.

Why the constructor is supported and the destructor does not?

Thanks in advance

Your question is not entirely clear to me, but I hope this helps:

Did you make sure that the constructors and destructors of the class you instantiate in the kernel are declared with the host device specifiers? Like so:

class A
{
    int member;

    public:
        __device__ __host__ A(int x)
        :
            member(x)
        {}
        
        __device__ __host__ ~A()
        {
        
        }
};

In your class, some of your members are instantiations of different classes, which should also be declared like the example above.