xcode 试图让 Code::Blocks 在 Mac 上运行,运行 Lion。无法正确设置编译器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10069278/
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-14 23:55:05  来源:igfitidea点击:

Trying to get Code::Blocks working on Mac, running Lion. Can't get the compiler set up properly

xcodeg++osx-lioncodeblocks

提问by tjtoml

First off, sorry if this is a stupid question. I installed code::blocks to try and get to know the program and start working on teaching myself c++. I have a MacBook Pro with OS 10.7.3. I ave code::blocks 10.05. When I try to build a "Hello world" nothing happens. Based on some googling I've figured out that it's because code::blocks doesn't know where to find the debugger/compiler. Further googling yielded me this pagewhich tells me to install Xcode and to fix some things in the code::blocks settings. However, this wiki obviously has not been updated since Apple went to the App store, because the file paths it gives for the compiler do not exist (there is no /Developer/* even after installing Xcode). Xcode 4.3.2 was already installed when I installed code::blocks and code::blocks "auto-detected" several compilers. They did not work. If anyone knows where Xcode hides its compilers now that Apple has moved to the app store, I would be much obliged.

首先,对不起,如果这是一个愚蠢的问题。我安装了 code::blocks 来尝试了解该程序并开始自学 C++。我有一台装有 OS 10.7.3 的 MacBook Pro。我有代码::块 10.05。当我尝试构建“Hello world”时,什么也没有发生。基于一些谷歌搜索,我发现这是因为 code::blocks 不知道在哪里可以找到调试器/编译器。进一步的谷歌搜索给了我这个页面它告诉我安装 Xcode 并修复 code::blocks 设置中的一些内容。不过这个wiki显然自从苹果上App store后就没有更新了,因为它给编译器的文件路径不存在(即使安装了Xcode也没有/Developer/*)。当我安装 code::blocks 和 code::blocks “自动检测”几个编译器时,Xcode 4.3.2 已经安装。他们没有工作。如果有人知道 Xcode 把它的编译器藏在哪里,因为 Apple 已经转移到了应用程序商店,我会非常感激。

回答by Michael Dautermann

Besides Xcode the app, you need to install the "command line tools", which allow you to call the compilers from the command line.

除了 Xcode 应用程序,您还需要安装“命令行工具”,它允许您从命令行调用编译器。

Go to this page: https://developer.apple.com/xcode/index.php

转到此页面:https: //developer.apple.com/xcode/index.php

And look under "Looking for additional developer tools". It'll require you to log in with your Apple developer ID (which is free to get if you haven't already paid the $99 for the program membership). Once you are in, the package you want to install next is "Command Line Tools for Xcode - Late March 2012" (or whatever the latest one listed there is).

并查看“寻找其他开发人员工具”。它将要求您使用您的 Apple 开发人员 ID 登录(如果您尚未支付 99 美元的计划会员资格,则可以免费获得)。进入后,接下来要安装的包是“Xcode 的命令行工具 - 2012 年 3 月下旬”(或任何列出的最新版本)。