Static assertion failed with “Windows headers require the default packing option…”

佐手、 提交于 2020-01-25 01:58:12

问题


When I'm trying to compile my C++ project in Visual Studio, I keep getting the 2 following errors:

E1574: Static assertion failed with "Windows headers require the default 
packing option. Changing this can lead to memory corruption. This diagnostic 
can be disabled by building with WINDOWS_IGNORE_PACKING_MISMATCH defined."

and

C2338: Windows headers require the default packing option. Changing this can 
lead to memory corruption. This diagnostic can be disabled by building with 
WINDOWS_IGNORE_PACKING_MISMATCH defined.

I think the issue has to be something in my Visual Studio settings, cause the project compiles fine on my other PC, and I just installed Visual Studio on this PC.

From doing some searches look like the issue stems from a mismatch of Windows packages, however when installing Visual Studio I tried to install all the C++ and Windows 10 modules I saw.

Also, I'm only including windows.h in order to use ShellExecute(), so if there's a better way to use ShellExecute() I'm open to that. Thanks!


回答1:


As 1201ProgramAlarm mentioned above, the solution was disabling the /Zp (structure packing) compiler option.



来源:https://stackoverflow.com/questions/56570681/static-assertion-failed-with-windows-headers-require-the-default-packing-option

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!