I have a C main file in which this .h file is included:
#pragma pack(1)
#ifndef PACKAGE
#define PACKAGE
struct A {
uint8_t a;
uint8_t b;
uint64_t c;
} typedef A;
#endif
After compiling the warning :
myfile.c:28:10: warning: the current #pragma pack alignment value is modified in
the included file [-Wpragma-pack]
#include "structures.h"
^
./structures.h:1:9: note: previous '#pragma pack' directive that modifies
alignment is here
#pragma pack(1)
appears.
I don't understand what's wrong in my code. Is there any way to delete this warning ?
Here is a complete example :
This is a simple C file called "myfile.c" :
#include "structures.h"
int main(){
return 0;
}
And this is the .h file called "structures.h" :
#include <stdlib.h>
#include <stdio.h>
#pragma pack(1)
#ifndef PACKAGE
#define PACKAGE
struct A {
uint8_t a;
uint8_t b;
uint64_t c;
} typedef A;
#endif
And the warning is :
myfile.c:2:10: warning: the current #pragma pack alignment value is modified in
the included file [-Wpragma-pack]
#include "structures.h"
^
./structures.h:5:11: note: previous '#pragma pack' directive that modifies
alignment is here
#pragma pack(1)
^
1 warning generated.