libc++ - 停止 std 重命名为 std::__1?
经过大量努力让 clang 和 libc++ 编译、运行、与 NetBeans 集成,甚至交叉编译到 32 位机器,我想我已经把这一切弄清楚了!所以我去使用 libstdc++ 没有的一些功能(这就是我的开发环境颠倒的全部原因),然后发现......我实际上无法做到这一点。
libc++ 已安装,它可以工作,并且编译的程序(当它工作时)确实需要它。然而,编译器仍然试图通过扰乱命名空间来利用每一个机会使用 libstdc++ 版本; std::__1::map
、std::__1::basic_string
等等。现在,我从知道这个问题 为什么会发生这种情况,以及 libc++ 为什么会这样做。我只需要知道如何删除它,因为它完全不适用 - 我真的非常想使用 libc++ 版本,并且我的代码中没有任何内容需要这两种类型共存。
我尝试将 libstdc++ 文件夹从包含路径中取出,但失败了,导致它们完全无法访问。运气不好。我没有使用任何附加库,仅使用内置的 Linux/POSIX 标头(errno、socket、syslog、fcntl)。
编辑:错误消息:
CoreCache.cpp:61:12: error: no member named 'emplace' in 'std::__1::map<std::__1::basic_string<char>, CacheEntry, std::__1::less<std::__1::basic_string<char> >, std::__1::allocator<std::__1::pair<const std::__1::basic_string<char>, CacheEntry> > >'
libstdc++ 映射没有 emplace()。 libc++ 版本可以。
从命令行进行的以下调用似乎有效:
clang++ -o stachecache -I /usr/local/lib/clang/3.1/include/ -I /usr/include/c++/v1/ -std=c++0x -stdlib=libc++ ./*.cpp
从 NetBeans 内部进行的调用无效:
clang++ -stdlib=libc++ -O3 -c -O3 -Werror -MMD -MP -MF build/Release/clang-Linux-x86/CoreCache.o.d -o build/Release/clang-Linux-x86/CoreCache.o CoreCache.cpp
After substantial effort getting clang and libc++ to compile, run, integrate with NetBeans, and even cross-compile to a 32-bit machine, I thought I had it all figured out! So I go to use some features that libstdc++ didn't have (the entire reason for turning my dev environment upside down), and discover... I can't actually do that.
libc++ is installed, it works, and the compiled program (when it works) does require it. However, the compiler still tries to use libstdc++ versions at every opportunity, by messing with the namespace; std::__1::map
, std::__1::basic_string
, and so on. Now, I know from this question why that happens, and why libc++ does it. I just need to know how to obliterate it, because it's completely inapplicable - I really, truly do want to use the libc++ versions, and there is nothing in my code that would require the two types to coexist.
I've tried taking the libstdc++ folders out of the include path, and, failing, that, made them completely inaccessible. No luck. I'm not using any add-on libraries, only built-in Linux/POSIX headers (errno, socket, syslog, fcntl).
EDIT: Error message:
CoreCache.cpp:61:12: error: no member named 'emplace' in 'std::__1::map<std::__1::basic_string<char>, CacheEntry, std::__1::less<std::__1::basic_string<char> >, std::__1::allocator<std::__1::pair<const std::__1::basic_string<char>, CacheEntry> > >'
The libstdc++ map does not have emplace(). The libc++ version does.
The following invocation, from the command line, seems to work:
clang++ -o stachecache -I /usr/local/lib/clang/3.1/include/ -I /usr/include/c++/v1/ -std=c++0x -stdlib=libc++ ./*.cpp
The invocation from within NetBeans does not:
clang++ -stdlib=libc++ -O3 -c -O3 -Werror -MMD -MP -MF build/Release/clang-Linux-x86/CoreCache.o.d -o build/Release/clang-Linux-x86/CoreCache.o CoreCache.cpp
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自评论:
From the comments: