【发布时间】:2013-04-19 07:04:54
【问题描述】:
我尝试将结构数组传递给常量内存,但我遇到了同样的问题。首先,我的结构是:
#define point_size 1024
struct Point {
short x;
short y;
Point (short xx, short yy){
x = xx;
y = yy;
}
Point (){
x = 0;
y = 0;
}
};
当我使用以下声明时,出现编译错误:无法为设备上的非空构造函数或析构函数生成代码
__constant__ Point points_once[point_size];
当我使用以下声明时,奇怪的一面是,它消失了。但是,它对我无效。
__constant__ Point *points_once[point_size];
我该如何解决这个问题。感谢您的帮助。 我使用最新的驱动程序和 Visual Studio 2010 以及 compute_30 和 sm_30 配置。
【问题讨论】:
-
尝试将构造函数定义为
__host__ __device__ Point (){ x = 0; y = 0; } -
我尝试了,但我得到了同样的错误。