I wrote some code and works perfectly using g++ compiler, but when I use gcc, it throws an error Unknow type name 'Image' in void load_image(FILE*, Image*);
Here's a part of my header file:
struct Image {
struct FileHeader file_header;
struct InfoHeader info_header;
struct RGBQuads rgbquads;
struct Pixel** pixel;
struct Pixel* pixels_array;
};
void load_image(FILE*, Image*);
So I cant understand whats the problem. I was trying to write using C rules.
It seems that you are compiling the program as a C program. If so then you have to write
void load_image(FILE*, struct Image*);
Another approach is to use typedef for the structure. For example
typedef struct Image {
struct FileHeader file_header;
struct InfoHeader info_header;
struct RGBQuads rgbquads;
struct Pixel** pixel;
struct Pixel* pixels_array;
} Image;
void load_image(FILE*, Image*);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With