Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Static assertion failed with "Windows headers require the default packing option..."

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!

like image 978
code4days Avatar asked Jun 12 '19 21:06

code4days


1 Answers

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

like image 92
code4days Avatar answered Nov 17 '22 18:11

code4days