小编kii*_*mmm的帖子

Clang无法在macOS中编译基本头文件(例如<iostream>)

我的macOS版本是 10.14

Xcode版本是 10.2

为clang编写插件。我只是使用以下命令从Github安装llvm和clang。

git clone https://github.com/llvm/llvm-project.git
cd llvm-project
mkdir build
cd build
cmake -G "Unix Makefiles" -DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi" ../llvm
Run Code Online (Sandbox Code Playgroud)

然后使用clang --version,它显示:

clang version 10.0.0 (https://github.com/llvm/llvm-project.git 73f702ff192475b27039325a7428ce037771a5de)
Target: x86_64-apple-darwin18.6.0
Thread model: posix
InstalledDir: /Users/kim/GitHub/llvm-project/build/bin
Run Code Online (Sandbox Code Playgroud)

现在,我只是尝试编译非常简单的Hello World程序:

git clone https://github.com/llvm/llvm-project.git
cd llvm-project
mkdir build
cd build
cmake -G "Unix Makefiles" -DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi" ../llvm
Run Code Online (Sandbox Code Playgroud)

用命令 clang++ test.cpp -o test

但不幸的是,它无法编译错误:

In file included from test.cpp:1:
In file included from /Users/kim/GitHub/llvm-project/build/bin/../include/c++/v1/iostream:37:
In file included from /Users/kim/GitHub/llvm-project/build/bin/../include/c++/v1/ios:214:
In file included from …
Run Code Online (Sandbox Code Playgroud)

c++ macos header-files llvm-clang libc++

6
推荐指数
1
解决办法
185
查看次数

标签 统计

c++ ×1

header-files ×1

libc++ ×1

llvm-clang ×1

macos ×1