libc ++ - stop std重命名为std :: __ 1? [英] libc++ - stop std renaming to std::__1?

查看:289
本文介绍了libc ++ - stop std重命名为std :: __ 1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

经过大量的努力,使clang和libc ++编译,运行,与NetBeans集成,甚至交叉编译到一个32位机器,我想我都有了这一切!所以我去使用libstdc ++没有的一些功能(整个原因,我的开发环境颠倒),并发现...我不能这样做。

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 ++安装,它工作,编译的程序(当它工作时)确实需要它。然而,编译器仍然试图使用libstdc ++版本在每一个机会,通过弄乱命名空间; std :: __ 1 :: map std :: __ 1 :: basic_string ,等等。现在,我从这个问题为什么会发生,为什么libc ++做到了。我只需要知道如何覆盖它,因为它完全不适用 - 我真的真的想使用libc ++版本,并且没有什么在我的代码,需要两种类型共存。

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.

我已经尝试将libstdc ++文件夹从包含路径中取出,但是,失败,使它们完全无法访问。没有运气。我不使用任何附加库,只有内置的Linux / POSIX头(errno,socket,syslog,fcntl)。

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).

/ strong>错误消息:

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> > >'

libstdc ++映射没有emplace libc ++版本

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

从NetBeans中调用不会:

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


推荐答案

从评论:


araqnid:
NetBeans调用没有 -std = c ++ 0x ,是否不需要? std :: map :: emplace 是一种C ++ 11方法。

araqnid: Your NetBeans invocation doesn't have -std=c++0x, is it not needed? std::map::emplace is a C++11 method.

DigitalMan: strong>
@araqnid其实就是这样! Clang抱怨说这个参数未被使用 - 事实上,即使它被使用和需要 - 所以我把它从NetBeans配置。错误的警告当然比完整的错误更好。

DigitalMan: @araqnid That actually did it! Clang complained about that argument being unused - and still does, in fact, even when it's used and required - so I had taken it out of the NetBeans configuration. A faulty warning is better than a complete error, certainly.

这篇关于libc ++ - stop std重命名为std :: __ 1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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