当使用LLVM的libc ++时,__1符号是从哪里来的? [英] Where does the __1 symbol come from when using LLVM's libc++?

查看:298
本文介绍了当使用LLVM的libc ++时,__1符号是从哪里来的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到很多问题,例如 Apple Mach-O Linker(Id)错误在IOS 64位项目的cryptopp中的未定义符号。问题通常描述为:

I see a fair amount of questions like Apple Mach-O Linker (Id) Error and Undefined symbols in cryptopp at IOS 64-bit project. The problem is usually described as:

Undefined symbols for architecture i386:
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush()", referenced from:
      cv::gpu::error(char const*, char const*, int, char const*) in opencv2(gpumat.o)

问题通常会减少到混合/匹配 -stdlib = libc ++ (LLVM C ++ runtime)和 -stdlib = libstdc ++ (GNU C ++ runtime)。 LLVM C ++运行时( libc ++ )有一个 __ 1 装饰符号,但GNU C ++运行时 libstdc ++ __ 1 符号。它会导致看起来具有相同名称的符号的链接器问题(例如 std :: string )。

The problem often reduces to mixing/matching -stdlib=libc++ (LLVM C++ runtime) and -stdlib=libstdc++ (GNU C++ runtime). The LLVM C++ runtime (libc++) has an __1 decoration symbol, but the GNU C++ runtime libstdc++ lacks the __1 symbol in its name. It causes linker problems for symbols that appears to have the same name (like std::string).

__ 1 符号是否来自使用LLVM的libc ++?

Where does the __1 symbol come from when using LLVM's libc++?

为什么不是使用 gnu 命名空间和 llvm 命名空间解决?

Why was the problem not solved with a gnu namespace and an llvm namespace?

这里有一个相关问题: libc ++ - 停止std重命名为std :: __ 1?

Here's a related question: libc++ - stop std renaming to std::__1?. But it kind of misses the point in that a rename does not occur.

推荐答案

这是来自C ++ 11内联的命名空间

It is from C++11 inlined namespaces

libc ++有类似

libc++ has something like

namespace std {
    inline namespace __1 {
        ....

/stackoverflow.com/questions/11016220/what-are-inline-namespaces-for \">什么是内联命名空间?

more at What are inline namespaces for?

这篇关于当使用LLVM的libc ++时,__1符号是从哪里来的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆