静态断言失败,出现"Windows headers require the default packing option..."

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

本文关键字:require the default option packing headers Windows 断言 失败 出现 静态      更新时间:2023-10-16

当我尝试在Visual Studio中编译我的C++项目时,我不断收到以下2个错误:

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."

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.

我认为问题一定是我的Visual Studio设置中的某个问题,因为该项目在我的另一台PC上编译良好,并且我刚刚在这台PC上安装了Visual Studio。

从进行一些搜索看起来问题源于Windows软件包的不匹配,但是在安装Visual Studio时,我尝试安装我看到的所有C++和Windows 10模块。

另外,我只包括windows.h才能使用ShellExecute(),所以如果有更好的使用方法ShellExecute()我对此持开放态度。谢谢!

正如上面提到的1201ProgramAlarm,解决方案是禁用/Zp(结构打包(编译器选项。

相关文章: