问题标签 [libc++]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
2396 浏览

compiler-construction - compiling libc++ with clang++ in Ubuntu

My OS is Ubuntu-11.04 i compiled llvm with clang as per the user manual successfully. then i tried to compile libcxx with clang++, i made modifications to the $LIBCXX_DIR/lib/buildit.sh by reading the following

http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-February/013228.html

The modified file $LIBCXX_DIR/lib/buildit is pasted after the error message.

with the modified buildit.sh i get following errors. It seems clang++ is unable to compile the header file 'string' successfully. Here is the complete compilation report:

//buildit.sh

0 投票
2 回答
6586 浏览

xcode - Xcode 4.2 + c++0x/libc++ 找不到 iostream

我正在使用 Macbook 1g,雪豹。

几天前,我安装了 xcode 4.2 并为 c++0x 做了一个测试项目。

我将 LLVM 3.0 设置为 c++ 编译器,将 C++ 语言方言设置为 C++0x,将 C++ 标准库设置为 libc++。

但是在构建时,发生了错误。

我觉得最令人困惑。我怎么解决这个问题?

0 投票
4 回答
37724 浏览

c++ - 使用 Libc++ 未定义引用使用 Clang 进行编译

第一对太长了,无法参考。当我尝试clang++ -stdlib=libc++ ../main.cc ...使用来自 SVN 的 clang 和 libc++ 进行编译时,出现此错误。

解决方案:感谢其中一个答案,我知道解决方案。libc++不能像 libstdc++ 一样单独使用,它必须与libc++abi一起链接。不过libc++abi还没有完成,所以目前使用libc++似乎有点不完整,但完成后仍然是我的首选。

2012 年 5 月 26 日更新: libc++abi 现在已完成 C++,我一直在成功使用 clang++,如下所示clang++ -std=c++11 -stdlib=libc++ -lc++abi

0 投票
1 回答
6720 浏览

xcode - Osx Lion:Xcode 4.1 如何设置 c++0x 项目

我知道还有其他类似的问题,但是(即我可以将 C++11 与 Xcode 一起使用吗?)但主要与旧版本的 Osx 或 xcode 有关,因此它们似乎并不是继续使用 Osx Lion 的正确解决方案和xcode 4.1。osx Lion 使用 c++0x 功能有什么要求?我想我必须以某种方式将 LLVM 3.0 设置为编译器,使用新的 libc++ 作为标准库。有没有让 LLVM 3.0 在 lion 上工作的默认方法?

编辑:好的,LLVM 3.0 成为 xcode 4 的一部分似乎只是时间问题:http: //oleb.net/blog/2011/07/whats-new-for-developers-in-lion-part-1 /

0 投票
2 回答
5755 浏览

c++ - clang_complete 错误:未知参数:'--std=c++0x'

clang++ 版本:2.9 vim 版本:7.3

我写我的.clang_comple

使用以下源代码test.cc

而 clang_complete 显示

在快速修复列表中。

我尝试添加选项

问题仍然存在。

试图跟踪clang_complete的一些代码,但仍然无法解决该问题。所有其他选项都可以正确处理,但不是--std=c++0x我错过了什么吗?还是做错了什么?

0 投票
3 回答
6021 浏览

c++ - 为什么有些包含文件只驻留在 tr1 中?

当我尝试包含<unordered_map>它失败并说该文件不存在时,而当我尝试包含<tr1/unordered_map>它时它会起作用。但是,找到了 c++03 中也存在的包含文件,并且是 c++11(如<vector>具有移动构造函数)。此外,仅在 c++11 中而不在 tr1 中的标头也可以正常找到,例如<thread>.
就像 tr1 中的所有新内容都被放入 tr1 文件夹中,而其他所有内容都被放入正常包含中。
为什么会这样?在不修改源文件的情况下是否有任何修复?
传递-I/path/to/include/tr1不起作用,因为所有内容都在 tr1 命名空间中。
我正在使用的编译器是

0 投票
2 回答
1084 浏览

c++ - 为什么uniform_int_distribution适用于 62 位数字但不适用于 63 或 64 位数字?

我很难理解为什么这段代码(尝试<random>在 C++11 中使用新标头)正确地生成随机数,[0, 2**62 - 1]但不是[0, 2**63 - 1]or [0, 2**64 - 1]

现在,更多的挖掘揭示了std::mt19937_64,它具有正确的行为,但是谁能向我解释为什么适用于 62 位数字的东西不适用于 64 位数字?

编辑:对不起,我什至没有指定问题。问题是对于 63 位和 64 位最大值,输出始终是 range 中的一个数字[0, 2**32 - 1],例如:

编辑 2:我正在使用clang++( Apple clang version 2.1 (tags/Apple/clang-163.7.1)) 和“libc++”。由于我的版本不c++0x支持,因此我无法使用 GCC 轻松测试上述内容。

0 投票
1 回答
3107 浏览

c++ - clang 3.0 + libc++ 中的 std::async 不起作用?

我刚刚在我的 ubuntu 10.04 上编译并安装了 clang+llvm 3.0,以及来自 svn 的 libc++。由于 libc++ 中的状态显示线程支持已完成,我想尝试 std::async。所以我按照安东尼威廉姆斯给出的例子

http://www.justsoftwaresolutions.co.uk/threading/multithreading-in-c++0x-part-8-futures-and-promises.html

只需稍作改动即可编译:

我编译

clang++ --std=c++0x -stdlib=libc++ -lpthread async.cpp

但是,它运行并始终以核心转储结束:

做事 生命、宇宙和一切的答案被中止(核心倾倒)

我检查了核心转储,它显示了这样的堆栈(我不太明白)

有人知道为什么吗?

0 投票
1 回答
24108 浏览

c++ - 为什么不能在 c++0x 模式下使用 libc++ 连接这个 boost::program_options 示例?

为 boost::program_options 编译此示例代码:http: //svn.boost.org/svn/boost/trunk/libs/program_options/example/first.cpp

...在 MacOS Lion (10.7.2) 上,使用与 MacPorts 一起安装的 boost-1.48.0:

使用 MacPorts 安装的 g++4.7 编译/链接的相同代码:

... 工作正常。与在没有 libc++ 的情况下使用 clang 一样:

怎么了?为什么 boost::program_options 和 libc++ 不能一起工作?

0 投票
2 回答
43230 浏览

c++ - 如何使用 clang++/libc++ 编译/链接 Boost?

这个问题的答案Why can't clang with libc++ in c++0x mode link this boost::program_options example?声明“您需要使用 clang++ -stdlib=libc++ 重建 boost。”

我正在使用带有 clang v3.0 的 MacOS Lion。如何使用 clang 构建 Boost v1.48.0 并将其与 libc++ 链接?

更新:我创建了一个user-config.jam文件,其中包含以下内容:

...这将使用 clang 而不是 gcc 构建 Boost。如何链接 libc++ 而不是 libstdc++?