安装 Xcode 后,clang 在哪里?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12228382/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 04:31:30  来源:igfitidea点击:

After install Xcode, where is clang?

xcodemacos

提问by mko

I installed the newest version of Xcode.

我安装了最新版本的 Xcode。

gcc,cc,clang, either of them exist in the terminal.

gcc,cc,clang,它们中的任何一个都存在于终端中。

How can I find the c compiler in the terminal that Xcode use?

如何在 Xcode 使用的终端中找到 c 编译器?

回答by hamstergene

Type in Terminal

输入终端

xcodebuild -find make
xcodebuild -find gcc
xcodebuild -find g++
xcodebuild -find clang
xcodebuild -find clang++

Each command prints full path to the corresponding tool. They are the ones that are used by Xcode.

每个命令都会打印到相应工具的完整路径。它们是 Xcode 使用的那些。

You can also install Xcode Command Line Tools which will place tools and libs under standard Unix locations (/usr/bin, /usr/includeetc.) if you want to be able to just type makeor gccwithout any paths. Note that these tools will be unrelated to the ones that Xcode application uses and may be of different versions.

您还可以安装Xcode的命令行工具,这将使工具和库在标准的Unix位置(/usr/bin/usr/include如果你想能够只是类型等),makegcc没有任何路径。请注意,这些工具将与 Xcode 应用程序使用的工具无关,并且可能具有不同的版本。

回答by dbr

Such commands have been made into a separate "command-line tools" package as of Xcode 4.3 or thereabouts

从 Xcode 4.3 开始,此类命令已被制作成一个单独的“命令行工具”包

They have been moved into the Xcode.appbundle as part of making Xcode a more standard App Store install. The separate CLI tools is also useful for projects like Homebrewwhich have no need for the full Xcode download

Xcode.app作为使 Xcode 成为更标准的 App Store 安装的一部分,它们已被移入捆绑包中。单独的 CLI 工具对于像 Homebrew这样不需要完整 Xcode 下载的项目很有用

To install (from here):

安装(从这里):

  • Open Xcode
  • Go to Preferences
  • Select Downloads and click Install for Command Line Tools (about 171 Megabyte)

Xcode command line tools Download page screenshot

  • 打开 Xcode
  • 转到首选项
  • 选择 Downloads 并单击 Install for Command Line Tools(约 171 兆字节)

Xcode命令行工具下载页面截图

回答by James Rome

It seems to have moved: jarmac:~ jar$ xcodebuild -find clang /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang

它似乎已经移动:jarmac:~ jar$ xcodebuild -find clang /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang

回答by Macmade

It's in Xcode app bundle:

它在 Xcode 应用程序包中:

/Applications/Xcode.app/Contents/Developer/usr/bin/