Bmp.c:8: warning:malformed ' #pragma pack (push[, id], <n>) '-ignored
Bmp.c:33:warning: #pragma pack (POP) encountered without matching #pragma pack (push, <n>)
This warning is important can not be ignored, I encountered this problem for the compiler is older, because Vedon comes with the virtual machine Ubuntu9.10 with the/work/tools/gcc-3.4.5-glibc-2.3.6, and the video compiler is 4.3, the compiler is higher
, this warning is about the alignment of the structure. For the lower compiler that comes with it, it's easy to fix this problem: modify the two structures in a BMP file
#include <config.h>
#include <pic_operation.h>
#include <picfmt_manager.h>
#include <file.h>
#include <stdlib.h>
#include <string.h>
#pragma pack (push)/* To save current pack set to stack */
#pragma pack (1)/* must be used before the struct definition, so that members of the struct are aligned by 1 bytes */
typedef struct TAGBITMAPFILEHEADER {/* BMFH */
unsigned short bftype;
unsigned long bfsize;
unsigned short bfReserved1;
unsigned short bfReserved2;
unsigned long bfoffbits;
} __attribute__ ((packed)) Bitmapfileheader;
typedef struct TAGBITMAPINFOHEADER {/* BMIH */
unsigned long bisize;
unsigned long biwidth;
unsigned long biheight;
unsigned short biplanes;
unsigned short bibitcount;
unsigned long bicompression;
unsigned long bisizeimage;
unsigned long bixpelspermeter;
unsigned long biypelspermeter;
unsigned long biclrused;
unsigned long biclrimportant;
} __attribute__ ((packed)) Bitmapinfoheader;
#pragma pack (POP)/* Restore previous pack settings */
Warning Malformed ' #pragma pack (push[, id], n) '-ignored