Error on Initializind struct variables in device functions

Hi,

The error “Error: External calls are not supported (found non-inlined call to _ZN9myarray20I6LINE_CEC1Ev)” pops up when i try to create a new struct object in the device function. My code is as follows.

[codebox]device void populateReducedContoursOfTileC(TILE_C *tile) {

bool withinTile;

        CONTOUR_C contourObject;

for (int i = 0; i < tile->contoursOfTile.numberofvaluesused; i++) {

.............

[/codebox]

CONTOUR_C is a structure in a seperate header file…

any ideas why this is happening??

Thanks

Would you please send you struct here? There something called myarray in you struct?

I think this is probably due to your struct’s constructor (or a constructor of one of its members) not being declared a device function. If you use structs in device code and they have constructors, they should be tagged as device.

Oops, sorry for that, i should have defined the structure here …

[codebox]

template

struct myarray20 {

myarray20() :

arrayvalue(), numberofvaluesused(0){

}

;

T arrayvalue[20];

int numberofvaluesused;

void reset() {numberofvaluesused = 0;}

};

struct LINE_C {

LINE_C() :

lineXY(), direction(0) {

}

;

int lineXY[4]; //Holds the Start and end (x,y) coordinates of the line

SHORT direction; //this indicates increase/decrease X/Y - incY - 0, decY - 1, IncX - 2, decX - 3;

}; //end class line

struct CONTOUR_C {

CONTOUR_C() :

contourBbox(), lineObjectForContour(), linesOfContour(), hasBeenIncludedInAGrid(0) {

}

;

int contourBbox[4]; //This array holds the coordinates of the bounding box

LINE_C lineObjectForContour;

bool hasBeenIncludedInAGrid; //Used to indicate if this contour has been included in a grid already

myarray20 <LINE_C> linesOfContour;

}; //end class contour[/codebox]

So, this is like JaredHoberock said. You should define the functions of the struct with a device modifier. Hope this will help you.

Thanks guys, i’ll do that and let you know what happens.