shark编译失败:static assert failed _DISABLE_EXTENDED_ALIGNED_STO



我按照这里描述的安装指南安装了Visual Studio 2022。我能够从git克隆,然后使用cmake生成一个VS2022 sln文件。但是,当我试图在VS2022中构建该解决方案时,我得到以下错误:

严重性代码描述项目文件行抑制状态
错误C2338 static_assert failed: '您已经实例化std:: aligned_storage< Len Align>与扩展对齐(在其他words, Align>alignof (max_align_t))。在VS 2017 15.8之前,成员"type"不符合规则的对齐会是only吗alignof (max_align_t)。VS 2017 15.8已修复以正确处理此问题,但是这个修复本质上改变了布局并破坏了二进制兼容性(仅用于使用扩展对齐的aligned_storage)。请定义(1)_ENABLE_EXTENDED_ALIGNED_STORAGE来确认这一点您理解了这条消息,并且实际上需要一个带有an的类型扩展对齐,或(2)_DISABLE_EXTENDED_ALIGNED_STORAGE到让这条信息沉默下来,找回原来的不一致的行为。鲨鱼C:Program FilesMicrosoft视觉Studio 2022 社区 VC MSVC 14.32.31326 工具包括 type_traits 987

我看到这个错误209次,这也是cmake生成的sln中的项目数量。当我双击其中一个错误时,我被带到一个名为type_traits的文件,我看到以下代码:

#ifndef _DISABLE_EXTENDED_ALIGNED_STORAGE
static_assert(_Always_false<_Aligned>,
"You've instantiated std::aligned_storage<Len, Align> with an extended alignment (in other "
"words, Align > alignof(max_align_t)). Before VS 2017 15.8, the member "type" would "
"non-conformingly have an alignment of only alignof(max_align_t). VS 2017 15.8 was fixed to "
"handle this correctly, but the fix inherently changes layout and breaks binary compatibility "
"(*only* for uses of aligned_storage with extended alignments). "
"Please define either "
"(1) _ENABLE_EXTENDED_ALIGNED_STORAGE to acknowledge that you understand this message and "
"that you actually want a type with an extended alignment, or "
"(2) _DISABLE_EXTENDED_ALIGNED_STORAGE to silence this message and get the old non-conforming "
"behavior.");
#endif // !_DISABLE_EXTENDED_ALIGNED_STORAGE

似乎我可能需要定义_DISABLE_EXTENDED_ALIGNED_STORAGE。请告诉我正确的做法是什么?

似乎Shark把它留给了编译它的人来选择天气来定义_ENABLE_EXTENDED_ALIGNED_STORAGE_DISABLE_EXTENDED_ALIGNED_STORAGE。我选择了后者。