tom66
February 16th, 2009, 01:47 AM
In file included from main.c:16:
textarea.c: In function ‘create_text_area’:
textarea.c:32: error: ‘struct P_TextAreaData’ has no member named ‘lineSpacing’
textarea.c:33: error: ‘struct P_TextAreaData’ has no member named ‘paraSpacing’
textarea.c:34: error: ‘struct P_TextAreaData’ has no member named ‘textAlign’
textarea.c:34: error: ‘AL_LEFT’ undeclared (first use in this function)
textarea.c:34: error: (Each undeclared identifier is reported only once
textarea.c:34: error: for each function it appears in.)
textarea.c:35: error: ‘struct P_TextAreaData’ has no member named ‘textAreaFloat’
textarea.c:35: error: ‘FLOAT_ABOVE’ undeclared (first use in this function)
textarea.c:39: error: ‘struct P_TextAreaData’ has no member named ‘canvasY2’
textarea.c:40: error: ‘struct P_TextAreaData’ has no member named ‘width’
textarea.c:41: error: ‘struct P_TextAreaData’ has no member named ‘height’
In file included from main.c:17:
draw.c: In function ‘render_objects_in_slide’:
draw.c:423: warning: passing argument 4 of ‘qsort’ from incompatible pointer type
But I do have a struct:
/* Structure for a text area. */
struct P_TextAreaData
{
/* Coordinates relative to the origin, which is in the centre of the object. */
double lastX, lastY;
double goalX, goalY;
/* Geometry of the text area. */
double canvasX1, canvasY1, canvasX2, canvas Y2;
double width, height;
/* Each text area can only have one of the following properties. */
enum P_TextAlign
{
AL_LEFT = 1,
AL_RIGHT = 2,
AL_CENTER = 3,
AL_JUSTIFY = 4
} textAlign;
double lineSpacing; /* Default: 1 */
double paraSpacing; /* Default: 2 */
enum P_AreaFloat
{
FLOAT_ABOVE = 1,
FLOAT_BELOW = 2,
FLOAT_INLINE = 3
} textAreaFloat;
/* The various text elements in the text area. */
struct P_TextAreaElement *elements;
/* Margins of the text area. */
struct P_Margins *margins;
};
And it's included before the function, if that matters. I don't understand. Here are the troublesome lines:
/* Create a text area, and associate it with our object. */
SAFE_MALLOC(ta, struct P_TextAreaData, 1);
ta[0].lineSpacing = 1.0;
ta[0].paraSpacing = 2.0;
ta[0].textAlign = AL_LEFT;
ta[0].textAreaFloat = FLOAT_ABOVE;
ta[0].canvasX1 = x1;
ta[0].canvasY1 = y1;
ta[0].canvasX2 = x2;
ta[0].canvasY2 = y2;
ta[0].width = 1.0;
ta[0].height = 1.0;
ta[0].lastX = 0.0;
ta[0].lastY = 0.0;
ta[0].goalX = ((x1 + x2) / 2.0);
ta[0].goalY = ((y1 + y2) / 2.0);
SAFE_MALLOC is a macro which maps to malloc but checks for NULL pointers. And I don't think that's the cause, because with a similar line of code (but no malloc):
struct P_TextAreaData *ta;
ta[0].lineSpacing = 1.0;
ta[0].paraSpacing = 2.0;
ta[0].textAlign = AL_LEFT;
ta[0].textAreaFloat = FLOAT_ABOVE;
ta[0].canvasX1 = x1;
ta[0].canvasY1 = y1;
ta[0].canvasX2 = x2;
ta[0].canvasY2 = y2;
ta[0].width = 1.0;
ta[0].height = 1.0;
ta[0].lastX = 0.0;
ta[0].lastY = 0.0;
ta[0].goalX = ((x1 + x2) / 2.0);
ta[0].goalY = ((y1 + y2) / 2.0);
the same errors are thrown.
Any help appreciated!
textarea.c: In function ‘create_text_area’:
textarea.c:32: error: ‘struct P_TextAreaData’ has no member named ‘lineSpacing’
textarea.c:33: error: ‘struct P_TextAreaData’ has no member named ‘paraSpacing’
textarea.c:34: error: ‘struct P_TextAreaData’ has no member named ‘textAlign’
textarea.c:34: error: ‘AL_LEFT’ undeclared (first use in this function)
textarea.c:34: error: (Each undeclared identifier is reported only once
textarea.c:34: error: for each function it appears in.)
textarea.c:35: error: ‘struct P_TextAreaData’ has no member named ‘textAreaFloat’
textarea.c:35: error: ‘FLOAT_ABOVE’ undeclared (first use in this function)
textarea.c:39: error: ‘struct P_TextAreaData’ has no member named ‘canvasY2’
textarea.c:40: error: ‘struct P_TextAreaData’ has no member named ‘width’
textarea.c:41: error: ‘struct P_TextAreaData’ has no member named ‘height’
In file included from main.c:17:
draw.c: In function ‘render_objects_in_slide’:
draw.c:423: warning: passing argument 4 of ‘qsort’ from incompatible pointer type
But I do have a struct:
/* Structure for a text area. */
struct P_TextAreaData
{
/* Coordinates relative to the origin, which is in the centre of the object. */
double lastX, lastY;
double goalX, goalY;
/* Geometry of the text area. */
double canvasX1, canvasY1, canvasX2, canvas Y2;
double width, height;
/* Each text area can only have one of the following properties. */
enum P_TextAlign
{
AL_LEFT = 1,
AL_RIGHT = 2,
AL_CENTER = 3,
AL_JUSTIFY = 4
} textAlign;
double lineSpacing; /* Default: 1 */
double paraSpacing; /* Default: 2 */
enum P_AreaFloat
{
FLOAT_ABOVE = 1,
FLOAT_BELOW = 2,
FLOAT_INLINE = 3
} textAreaFloat;
/* The various text elements in the text area. */
struct P_TextAreaElement *elements;
/* Margins of the text area. */
struct P_Margins *margins;
};
And it's included before the function, if that matters. I don't understand. Here are the troublesome lines:
/* Create a text area, and associate it with our object. */
SAFE_MALLOC(ta, struct P_TextAreaData, 1);
ta[0].lineSpacing = 1.0;
ta[0].paraSpacing = 2.0;
ta[0].textAlign = AL_LEFT;
ta[0].textAreaFloat = FLOAT_ABOVE;
ta[0].canvasX1 = x1;
ta[0].canvasY1 = y1;
ta[0].canvasX2 = x2;
ta[0].canvasY2 = y2;
ta[0].width = 1.0;
ta[0].height = 1.0;
ta[0].lastX = 0.0;
ta[0].lastY = 0.0;
ta[0].goalX = ((x1 + x2) / 2.0);
ta[0].goalY = ((y1 + y2) / 2.0);
SAFE_MALLOC is a macro which maps to malloc but checks for NULL pointers. And I don't think that's the cause, because with a similar line of code (but no malloc):
struct P_TextAreaData *ta;
ta[0].lineSpacing = 1.0;
ta[0].paraSpacing = 2.0;
ta[0].textAlign = AL_LEFT;
ta[0].textAreaFloat = FLOAT_ABOVE;
ta[0].canvasX1 = x1;
ta[0].canvasY1 = y1;
ta[0].canvasX2 = x2;
ta[0].canvasY2 = y2;
ta[0].width = 1.0;
ta[0].height = 1.0;
ta[0].lastX = 0.0;
ta[0].lastY = 0.0;
ta[0].goalX = ((x1 + x2) / 2.0);
ta[0].goalY = ((y1 + y2) / 2.0);
the same errors are thrown.
Any help appreciated!