Xcode 预处理器输出

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

Xcode Preprocessor Output

objective-cxcodec-preprocessorpch

提问by MacMark

I want to check the output of the preprocessor for some files. How can I view the preprocessor's output in Xcode?

我想检查一些文件的预处理器的输出。如何在 Xcode 中查看预处理器的输出?

采纳答案by MacMark

Xcode 4.1 features now "Preprocessor or Assembly Output". All be happy!

Xcode 4.1 现在具有“预处理器或程序集输出”功能。都要快乐!

回答by Steven Hepting

You can choose the "Show the Assistant editor" view in the top right set of buttons in the toolbar.

您可以在工具栏右上角的一组按钮中选择“显示助手编辑器”视图。

enter image description here

在此处输入图片说明

Then, at the top of the right-hand editor you can click the little Related Filesbutton and then either choose Preprocessor Assembly.

然后,在右侧编辑器的顶部,您可以单击小Related Files按钮,然后选择PreprocessAssembly

enter image description here

在此处输入图片说明

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

您可以在此处并排查看预处理器输出和生成的汇编代码的示例:

enter image description here

在此处输入图片说明

回答by jt bullitt

@whoKnows's excellent and concise answer applies to Xcode 6 users. The preprocessor menu seems to wander all over the place from one Xcode version to another.

@whoKnows 出色而简洁的答案适用于 Xcode 6 用户。预处理器菜单似乎从一个 Xcode 版本到另一个版本到处游荡。

To recap: XCode 6 users can view preprocessor output by pulling down this menu:

回顾一下:XCode 6 用户可以通过下拉此菜单来查看预处理器输出:

Product -> Perform Action -> Preprocess

as illustrated in the accompanying screenshot. I couldn't find this anywhere in the Xcode documentation.

如随附的屏幕截图所示。我在 Xcode 文档中的任何地方都找不到它。

(I hope this helps. I would have preferred to simply add a comment to @whoKnows's answer, but I don't have privileges for that yet.)

(我希望这会有所帮助。我宁愿简单地在@whoKnows 的答案中添加评论,但我还没有权限。)

screenshot of menu pulldowns for viewing preprocessor output

用于查看预处理器输出的菜单下拉屏幕截图

回答by Kyle

You can always just run the preprocessor on the files from the command line using the -Eflag with llvm-gcc(this is what Xcode 4 uses as a replacement for GCC). Something like this:

您始终可以使用-E带有标志的命令行对文件运行预处理器llvm-gcc(这是 Xcode 4 用作 GCC 的替代品)。像这样的东西:

llvm-gcc -E -o output.preprocess input.c

Then you can just open up the output file in a text editor.

然后您可以在文本编辑器中打开输出文件。

回答by whoKnows

<menubar> -> Product -> Perform action -> Preprocess <the name of your file>

<menubar> -> Product -> Perform action -> Preprocess <文件名>

回答by Learner

I did not find any way too. Seems that "Preprocess" feature is missing in Xcode 4. I haven't read any document from apple, where they mentioned anything about this.

我也没有找到任何方法。Xcode 4 中似乎缺少“预处理”功能。我还没有读过任何来自苹果的文档,他们在那里提到了任何相关内容。

Following uri might help you: http://pilky.me/view/15

以下 uri 可能对您有所帮助:http: //pilky.me/view/15