IGraphics->AllocBitMap : dereferencing pointer to incomplete

This forum is for general developer support questions.

IGraphics->AllocBitMap : dereferencing pointer to incomplete

Postby AmiDARK » Tue Dec 11, 2018 1:20 am

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
AmiDARK
 
Posts: 40
Joined: Thu Oct 20, 2011 10:23 am

Re: IGraphics->AllocBitMap : dereferencing pointer to incomp

Postby broadblues » Tue Dec 11, 2018 1:40 am

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
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 591
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: IGraphics->AllocBitMap : dereferencing pointer to incomp

Postby Rigo » Tue Dec 11, 2018 8:33 am

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

Simon
User avatar
Rigo
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 339
Joined: Mon Jan 17, 2011 10:42 pm

Re: IGraphics->AllocBitMap : dereferencing pointer to incomp

Postby tonyw » Tue Dec 11, 2018 1:38 pm

@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
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 1384
Joined: Wed Mar 09, 2011 2:36 pm
Location: Sydney, Australia

Re: IGraphics->AllocBitMap : dereferencing pointer to incomp

Postby AmiDARK » Tue Dec 11, 2018 5:00 pm

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 8:18 pm, edited 1 time in total.
Sam440EP - AmigaOS 4.1 Final Edition
AmiDARK
 
Posts: 40
Joined: Thu Oct 20, 2011 10:23 am

Re: IGraphics->AllocBitMap : dereferencing pointer to incomp

Postby salass00 » Tue Dec 11, 2018 7:12 pm

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.
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 512
Joined: Sat Jun 18, 2011 4:12 pm
Location: Finland

Re: IGraphics->AllocBitMap : dereferencing pointer to incomp

Postby AmiDARK » Tue Dec 11, 2018 8:18 pm

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
AmiDARK
 
Posts: 40
Joined: Thu Oct 20, 2011 10:23 am


Return to General Developer Support

Who is online

Users browsing this forum: No registered users and 3 guests