Hi Everyone,
I’m hoping someone can shed some light on an error I am receiving from cudafe.exe - it crashes and I get a
"1>cuda_code.cu(70): internal error: can’t generate code for non empty constructors or destructors on device
1>1 catastrophic error detected in the compilation of “C:\Users\SEBAST~1\AppData\Local\Temp/tmpxft_0000096c_00000000-6_cuda_code.cpp1.ii”." error.
#ifndef __POINT3D__
#define __POINT3D__
struct Point3D {
struct { float x, y, z; };
__device__ Point3D() {}
__device__ Point3D(const float a, const float b, const float c) : x(a), y(b), z(c) {}
__device__ Point3D operator+(const Point3D rhs) const { return Point3D(x+rhs.x, y+rhs.y, z+rhs.z); }
__device__ Vector3D operator-(const Point3D rhs) const { return Vector3D(x-rhs.x, y-rhs.y, z-rhs.z); }
__device__ Point3D operator+(const float rhs) const { return Point3D(x+rhs, y+rhs, z+rhs); }
__device__ Point3D operator-(const float rhs) const { return Point3D(x-rhs, y-rhs, z-rhs); }
__device__ Point3D operator*(const float rhs) const { return Point3D(x*rhs, y*rhs, z*rhs); }
__device__ Point3D operator/(const float rhs) const { return Point3D(x/rhs, y/rhs, z/rhs); }
__device__ float d_squared(const Point3D& p) const
{
return ((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y) + (z - p.z) * (z - p.z));
}
__device__ float distance(const Point3D& p) const
{
return (sqrt((x - p.x) * (x - p.x)+ (y - p.y) * (y - p.y)+ (z - p.z) * (z - p.z)));
}
};
#endif
#ifndef __CAMERA__
#define __CAMERA__
struct Camera{
Point3D lookat, eye;
float ra;
Vector3D u, v, w;
Vector3D up;
float exposure_time;
float d, zoom;
__device__ Camera(){}
__device__ Camera(const int test) :
eye(0, 0, 500),
lookat(0, 0, 0),
ra(0),
up(0, 1, 0),
u(1, 0, 0),
v(0, 1, 0),
w(0, 0, 1),
exposure_time(1.0)
{}
__device__ void set_eye(const float x, const float y, const float z)
{
eye.x = x; eye.y = y; eye.z = z;
}
};
#endif
Ok, thats my code above. I’m creating a camera in const memory using this:
__constant__ Camera cam;
That’s when the error is generated. Why is there a problem with have my Point3D structs within my Camera struct? I removed the structs so that the only members were floats and it compiled fine. Please, someone help me!
Seb