Xcode 预处理器输出
我想检查某些文件的预处理器的输出。如何在 Xcode 中查看预处理器的输出?
I want to check the output of the preprocessor for some files. How can I view the preprocessor's output in Xcode?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您可以在工具栏右上角的一组按钮中选择“显示助理编辑器”视图。
然后,在右侧编辑器顶部,您可以单击小
相关文件< /code> 按钮,然后选择
预处理
或汇编
。您可以在此处并排查看预处理器输出和生成的汇编代码的示例:
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 choosePreprocess
orAssembly
.You can see an example of both the preprocessor output and generated assembly code all side-by-side here:
Xcode 4.1 现在提供“预处理器或程序集输出”功能。皆大欢喜!
Xcode 4.1 features now "Preprocessor or Assembly Output". All be happy!
@whoKnows 的优秀而简洁的答案适用于 Xcode 6 用户。预处理器菜单似乎在从一个 Xcode 版本到另一个版本之间徘徊。
回顾一下:XCode 6 用户可以通过下拉此菜单来查看预处理器输出:
如随附的屏幕截图所示。我在 Xcode 文档中找不到这个。
(我希望这会有所帮助。我更愿意简单地在 @whoKnows 的答案中添加评论,但我还没有这样做的权限。)
@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.
To recap: XCode 6 users can view preprocessor output by pulling down this menu:
as illustrated in the accompanying screenshot. I couldn't find this anywhere in the Xcode documentation.
(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.)
您始终可以使用
-E
标志和llvm-gcc
从命令行对文件运行预处理器(这是 Xcode 4 用来替代 GCC 的方法) 。像这样:然后您可以在文本编辑器中打开输出文件。
You can always just run the preprocessor on the files from the command line using the
-E
flag withllvm-gcc
(this is what Xcode 4 uses as a replacement for GCC). Something like this:Then you can just open up the output file in a text editor.
<菜单栏> ->产品->执行动作->预处理<您的文件的名称>
<menubar> -> Product -> Perform action -> Preprocess <the name of your file>
我也没有找到什么办法。 Xcode 4 中似乎缺少“预处理”功能。我还没有阅读过苹果公司的任何文档,他们在其中提到过任何有关此的内容。
以下 uri 可能会对您有所帮助:http://pilky.me/view/15
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.
Following uri might help you: http://pilky.me/view/15