Xcode创建pch文件
来源:互联网 发布:银魂 空知猩猩 编辑:程序博客网 时间:2024/05/17 09:46
关于pch的得与失,stackoverflow上有段话讲的比较透彻:http://stackoverflow.com/questions/24158648/why-isnt-projectname-prefix-pch-created-automatically-in-xcode-6
As to where to put code that you would put in a prefix header, there is no code you should put in a prefix header. Put your imports into the files that need them. Put your definitions into their own files. Put your macros...nowhere. Stop writing macros unless there is no other way (such as when you need __FILE__). If you do need macros, put them in a header and include it.
The prefix header was necessary for things that are huge and used by nearly everything in the whole system (like Foundation.h). If you have something that huge and ubiquitous, you should rethink your architecture. Prefix headers make code reuse hard, and introduce subtle build problems if any of the files listed can change. Avoid them until you have a serious build time problem that you can demonstrate is dramatically improved with a prefix header.
In that case you can create one and pass it into clang, but it's incredibly rare that it's a good idea.
但有些时候,还是需要pch文件的,那么怎么在Xcode6中添加一个pch文件呢?
首先,Command+N,打开新建文件窗口:ios->other->PCH file,创建一个pch文件,添加需要引入的头文件名:
其次,修改工程配置文件,将刚刚创建的PCH file的路径添加到building setting中的precompile header选项中去,注意debug和release两栏都要添加:
至此,大功告成,编译一遍,新添加的pch文件就可以正常使用了^_^。
原创:http://blog.csdn.net/lihuiqwertyuiop/article/details/39268101
- Xcode创建pch文件
- Xcode 6 pch创建文件
- xcode 6 创建pch文件
- XCode中创建pch文件
- Xcode 6 创建 pch文件
- XCode中创建pch文件
- xcode Pch文件创建及添加
- Xcode 6之后创建PCH文件
- Xcode 创建一个pch
- Xcode没有pch文件
- xcode Prefix.pch文件
- Xcode中 .pch文件
- Xcode 新建pch文件
- Xcode配置.pch文件
- Xcode增加pch文件
- Xcode中的pch文件
- Xcode 添加PCH文件
- xcode加载pch文件
- MATALB: sparse函数
- 枚举窗口
- ListCtrl经验总结(I)
- 得到某个类的静态属性 java反射机制
- Android中清楚webView缓存
- Xcode创建pch文件
- Linux设备驱动的分层设计思想
- redhat下yum的安装
- OpenStack对象存储:Swift架构详解
- C# IL指令--破解必备
- mysql 5.5 对于非聚集索引增删操作方式的变更和优化
- MyEclipse配置Tomcat 并编写第一个JSP程序
- c#调用c++封装dll 参数为字符串输出函数的解决办法
- Linux主机驱动与外设驱动分离思想