Question: I have two applications written in C that include the same header. In this header I have the declaration of a struct. I use the GCC compiler to compile both applications.

When I execute both applications, they produce different values of `sizeof(struct-defined-in-the-header)`.

Why does this happen?

Answer: 
In my case it wasn't gcc and it was single application, but there were different results of sizeof(MyStruct) in different .c files.
The reason was in different packing values for structures, because those .c files had included different sets of .h files before including header with declaration of MyStruct.
The solution I adopted was to create general header with setting appropriate packing value and including it into all my .h files after system and library headers, but before my headers.
I use Eclipse to compile the programs. I checked flags of compilation. Look:

```
    gcc -I/lib-header-directory-with-struct -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"program-a.d" -MT"program-a.d" -o"program-a.o" "../program-a.c"

    gcc -I/lib-header-directory-with-struct -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"program-b.d" -MT"program-b.d" -o"program-b.o" "../program-b.c"
    gcc -L/lib-directory-with-struct -o"program-b" -l<lib-with-struct>

```

The difference between them is that in one I used the lib and in another I used struct definition only.

I used `gcc -E` and redirect stdout to file. I looked for struct definition in this file and it is the same in both programs.