_GLIBCXX_USE_CXX11_ABI在RHEL6和RHEL7上被禁用了吗? [英] _GLIBCXX_USE_CXX11_ABI disabled on RHEL6 and RHEL7?
本文介绍了_GLIBCXX_USE_CXX11_ABI在RHEL6和RHEL7上被禁用了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在RHEL6和RHEL7上有gcc 5.2.1,看起来_GLIBCXX_USE_CXX11_ABI被禁用了.即使我手动运行-D_GLIBCXX_USE_CXX11_ABI=1 -std=c++14
,它也不起作用.这意味着我不会获得小的字符串优化功能.例如,以下代码的输出始终为8和未设置微".对于SSO,如果我们查看代码bit/basic_string.h,则std :: string的大小应至少为16.有什么解决方法吗?
I have gcc 5.2.1 on RHEL6 and RHEL7, and it looks like _GLIBCXX_USE_CXX11_ABI gets disabled. It's not working even if I manually run -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++14
. This means I won't get small string optimization feature. For example, the output of following code always have 8 and 'micro not set'. For SSO, size of std::string should be at least 16 if we look at code bits/basic_string.h. Any workaround?
#include <string>
#include <iostream>
int main()
{
std::cout << sizeof(std::string) << std::endl;
#if _GLIBCXX_USE_CXX11_ABI
std::cout << "macro set" << std::endl;
#else
std::cout << "macro not set" << std::endl;
#endif
}
推荐答案
查看全文