c++ - 静态断言失败,返回 "Windows headers require the default packing option..."

标签 c++ windows visual-studio header-files

当我尝试在 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(结构打包)编译器选项。

关于c++ - 静态断言失败,返回 "Windows headers require the default packing option...",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56570681/

相关文章:

c++ - void() 问题 - 它不打印结果

未加载 PHP 7 curl

c++ - 某些用户的 OpenProcess 访问被拒绝

C++ 更新 OpenGL/Glut 窗口

c++ - 使用自定义类集时出错

c++ - 哪个 C++ 规范开始支持 std::vector

c++ - 如何在Windows 8中设置关联?

visual-studio - 从 Visual Studio Express 发布

c++ - 如何使用visual studio在c中捕获全屏

c++ - 嵌入式汇编程序编译错误