Warning Malformed ' #pragma pack (push[, id], n) '-ignored

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.