How to translate the below vc++ packing commands into gcc commands in Linux? I am aware how to do it for a single struct, but how do I do this for a range of struct?
#pragma pack(push, 1) // exact fit - no padding
//structures here
#pragma pack(pop) //back to whatever the previous packing mode was
You can add attribute((packed)) to individual data items to achieve this. In this case the packing is applied for a data item, so no need to restore the old mode.
Ex :
For Structures :
For data members :