Skip to main content
gamedev.net
🔒 Locked

dereferencing pointer to imcomplete type ?

Started by keethrus Dec 28, 2002 at 2:47 PM 1 replies 200+ views
Original Post
keethrus
keethrus
blah.
struct myImage
{
	Uint8 *pixels;
	Uint16 width, height;
};

// in main

struct myImage *smiley;
// load an image
// memory is allocated for pixels in struct myImage
free( smiley->pixels );
 
for some reason, the line "free( smiley->pixels );" is giving me a compiler error. (the error is the subject of this post). any suggestions how to fix this? - jeremiah
Zipster
Zipster
quote:
(the error is the subject of this post)

I doubt the compiler would print "imcomplete", but oh well

An incomplete type means that the compiler can''t determine the size of it. This happens when you declare a structure pointer, but the compiler hasn''t seen the structure definition yet. You try to defer it, but the compiler has no knowledge of it, and it complains. Is your structure definition in the same translation unit as the free call?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.