 
 void
 pcl::device::generateTriangles (const PtrStep<short2>& volume, const DeviceArray2D<int>& occupied_voxels, const float3& volume_size, DeviceArray<PointType>& output)
-{
-  TrianglesGenerator tg;
+{    
+  typedef TrianglesGenerator Tg;
+  Tg tg;
 
   tg.volume = volume;
   tg.occupied_voxels = occupied_voxels.ptr (0);

  {
    struct TrianglesGenerator : public CubeIndexEstimator
    {
      enum { CTA_SIZE = 256 };

      const int* occupied_voxels;
      const int* vertex_ofssets;

      operator () () const
      {
        int tid = threadIdx.x;
        int idx = (blockIdx.y * MAX_GRID_SIZE_X + blockIdx.x) * CTA_SIZE + tid;
      

        if (idx >= voxels_count)
          return;
