Reputation: 55
I have an old C++ program I recovered to update and re-use it with Visual Studio 2019.
When I try to compile winnt.h
, it gives the error:
Windows headers require the default packing option. Changing this can lead to memory corruption. This diagnosis can be disabled by building with WINDOWS_IGNORE_PACKING_MISMATCH defined
I saw this post Static assertion failed with "Windows headers require the default packing option..." and I already changed the packing option from 4bytes to default (Project Settings > C/C++ > Code Generation > Struct Member Alignment (change to Default)).
What am I missing? How can I solve it?
Upvotes: 3
Views: 4838
Reputation: 1923
Check if #pragma pack
is used in the code. If you use #pragma pack
, do not set Struct Member Alignment
in the project configuration, because it will disturb the direct alignment of other code.
Check whether your project platform settings are consistent with the property page settings.
Upvotes: 2