Jus*_*lor 6 c++ windows header-files visual-studio
当我尝试在 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."
Run Code Online (Sandbox Code Playgroud)
和
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.
Run Code Online (Sandbox Code Playgroud)
我认为问题必须出在我的 Visual Studio 设置中,导致该项目在我的另一台 PC 上编译得很好,而我刚刚在这台 PC 上安装了 Visual Studio。
从进行一些搜索来看,问题似乎源于 Windows 软件包不匹配,但是在安装 Visual Studio 时,我尝试安装我看到的所有 C++ 和 Windows 10 模块。
另外,我只是windows.h为了使用而包括在内ShellExecute(),所以如果有更好的使用方式,ShellExecute()我愿意接受。谢谢!
Jus*_*lor 10
正如上面提到的 1201ProgramAlarm ,解决方案是禁用/Zp(结构打包)编译器选项。