error C2338: You've instantiated std::aligned_storage<Len, Align> with an extended alignment (in oth...

 

 

报的完整错误为:

error C2338: 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-conformant behavior.

  

 

  

大概意思就是:VS2017 15.8版本修复了老版本有关对齐存储部分缺陷,但修复本身也有缺陷。如果不想编译时报这个问题,就在预编译时定义一个宏 _ENABLE_EXTENDED_ALIGNED_STORAGE 或者 _DISABLE_EXTENDED_ALIGNED_STORAGE(博主的理解是按照修复后的逻辑处理就定义带enable那个,按照老版本的逻辑处理就定义带disable那个)

参考解决方法:

打开 项目属性页 -- > C/C++  --> Preprocessor --> Preprocessor Definitions

里面添加,_DISABLE_EXTENDED_ALIGNED_STORAGE

即可。

 

 

 

 

 

 

参考文章

error C2338: You've instantiated std::aligned_storage《Len, Align》 with an extended alignment.(讨论)

转载于:https://www.cnblogs.com/arxive/p/11216354.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值