静态断言失败 "Windows headers require the default packing option..."
Static assertion failed with "Windows headers require the default packing option..."
当我尝试在 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 设置上,因为该项目在我的另一台电脑上编译正常,而我刚刚在这台电脑上安装了 Visual Studio。
从一些搜索来看,问题似乎源于 Windows 包的不匹配,但是在安装 Visual Studio 时,我尝试安装所有的 C++ 和 Windows 10 个我看到的模块.
此外,我只是为了使用 ShellExecute()
而包含 windows.h
,所以如果有更好的方法来使用 ShellExecute()
,我愿意接受。谢谢!
正如上面提到的 1201ProgramAlarm,解决方案是禁用 /Zp
(结构打包)编译器选项。
当我尝试在 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 设置上,因为该项目在我的另一台电脑上编译正常,而我刚刚在这台电脑上安装了 Visual Studio。
从一些搜索来看,问题似乎源于 Windows 包的不匹配,但是在安装 Visual Studio 时,我尝试安装所有的 C++ 和 Windows 10 个我看到的模块.
此外,我只是为了使用 ShellExecute()
而包含 windows.h
,所以如果有更好的方法来使用 ShellExecute()
,我愿意接受。谢谢!
正如上面提到的 1201ProgramAlarm,解决方案是禁用 /Zp
(结构打包)编译器选项。