IGraphics->AllocBitMap : dereferencing pointer to incomplete

This forum is for general developer support questions.
Post Reply
AmiDARK
Posts: 40
Joined: Thu Oct 20, 2011 9:23 am

IGraphics->AllocBitMap : dereferencing pointer to incomplete

Post by AmiDARK »

Hello,

When I use :
displayCore.mainBitMap = IGraphics->AllocBitMap( screenConfig->Width, screenConfig->Height, screenConfig->Depth, BMF_INTERLEAVED, NULL );
I got this error message :
Display.c:169: error: dereferencing pointer to incomplete type
I define in the displayCore :
struct BitMap * mainBitMap;
in screenConfig, Width, Height and Depth are set as ULONG
I don't understand.
Sam440EP - AmigaOS 4.1 Final Edition

User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 591
Joined: Sat Jun 18, 2011 2:40 am
Location: Portsmouth, UK
Contact:

Re: IGraphics->AllocBitMap : dereferencing pointer to incomp

Post by broadblues »

You may have defined them, but the error sugests that the definition has not been included, or possibly there is a typo in the variable declaration, leading to an unknown type

User avatar
Rigo
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 346
Joined: Mon Jan 17, 2011 9:42 pm

Re: IGraphics->AllocBitMap : dereferencing pointer to incomp

Post by Rigo »

Have you "included" <proto/graphics.h> ?

Simon

User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1415
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: IGraphics->AllocBitMap : dereferencing pointer to incomp

Post by tonyw »

@AmiDark:
broadblues wrote:You may have defined them, but the error suggests that the definition has not been included, or possibly there is a typo in the variable declaration, leading to an unknown type
What you included above is a declaration, not a definition. It only declares that a "struct BitMap" is to be stored at that location, without defining what a "struct BitMap" is.

The definition goes along the lines of:

struct BitMap
{
...;
...;
...
};

As Rigo says, it is defined by "including" proto/graphics.h, which in turn defines all the structures you will ever need for graphics.
cheers
tony

AmiDARK
Posts: 40
Joined: Thu Oct 20, 2011 9:23 am

Re: IGraphics->AllocBitMap : dereferencing pointer to incomp

Post by AmiDARK »

Hello everyone and thank you for your answers.

I got wrong because I included <graphics/gfx.h> that contain this definition of BitMap :
struct BitMap
{
UWORD BytesPerRow;
UWORD Rows;
UBYTE Flags;
UBYTE Depth;
UWORD pad;
PLANEPTR Planes[8];
};

I have included <proto/graphics.h> and it solved my issue.
Thank you.

Now I hope my screen/window system will fully work .. Will test it later today.

Regards,
AmiDARK
Last edited by AmiDARK on Tue Dec 11, 2018 7:18 pm, edited 1 time in total.
Sam440EP - AmigaOS 4.1 Final Edition

User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 519
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: IGraphics->AllocBitMap : dereferencing pointer to incomp

Post by salass00 »

In this case it was the definition of the GraphicsIFace structure that was missing that was the problem, hence why IGraphics couldn't be dereferenced to get the AllocBitMap() function.

Including <proto/graphics.h> which in turn includes <interfaces/graphics.h> solved it.

AmiDARK
Posts: 40
Joined: Thu Oct 20, 2011 9:23 am

Re: IGraphics->AllocBitMap : dereferencing pointer to incomp

Post by AmiDARK »

salass00 wrote:In this case it was the definition of the GraphicsIFace structure that was missing that was the problem, hence why IGraphics couldn't be dereferenced to get the AllocBitMap() function.

Including <proto/graphics.h> which in turn includes <interfaces/graphics.h> solved it.
Will try this.
Thank you.
Sam440EP - AmigaOS 4.1 Final Edition

Post Reply