我想检查一些文件的预处理器的输出。如何在 Xcode 中查看预处理器的输出?
6 回答
You can choose the "Show the Assistant editor" view in the top right set of buttons in the toolbar.

Then, at the top of the right-hand editor you can click the little Related Files button and then either choose Preprocess or Assembly.

You can see an example of both the preprocessor output and generated assembly code all side-by-side here:

Xcode 4.1 现在具有“预处理器或汇编输出”功能。都开心!
@whoKnows 出色而简洁的答案适用于 Xcode 6 用户。预处理器菜单似乎从一个 Xcode 版本到另一个版本到处游荡。
回顾一下:XCode 6 用户可以通过下拉此菜单来查看预处理器输出:
Product -> Perform Action -> Preprocess
如随附的屏幕截图所示。我在 Xcode 文档中的任何地方都找不到这个。
(我希望这会有所帮助。我宁愿简单地在@whoKnows 的答案中添加评论,但我还没有权限。)

-E您始终可以使用with 标志从命令行对文件运行预处理器llvm-gcc(这是 Xcode 4 用作 GCC 的替代品)。像这样的东西:
llvm-gcc -E -o output.preprocess input.c
然后您可以在文本编辑器中打开输出文件。
<菜单栏> -> 产品 -> 执行操作 -> 预处理 <文件名>
我也没有找到任何办法。似乎 Xcode 4 中缺少“预处理”功能。我还没有阅读苹果的任何文档,他们在其中提到了任何关于此的内容。
关注 uri 可能会对您有所帮助:http: //pilky.me/view/15