How to stop huge Prefix.pch.gch file from being copied into application bundle

前端 未结 5 416
醉梦人生
醉梦人生 2021-01-19 10:30

For some reason, XCode has decided to start copying a huge Prefix.pch.gch file into my application\'s resources folder when building. This file is not in the Copy Bundle Re

相关标签:
5条回答
  • 2021-01-19 10:44

    I had a problem with the same symptoms today, it turned out that it was due to one of my objective C files being included in the Copy Bundle Resources files phase of the target (either due to a drag and drop accident, or the xcodeproj file getting corrupted at some point). GCC was then helpfully including the precompiled headers for the prefix header in the target as there is a dependency from the source file.

    Doing a Get Info on the source file in question didn't show all the tabs on the file info dialog, even though the file type was set to sourcecode.c.objc.

    Removing the file from the project and re-adding it cured the problem.

    0 讨论(0)
  • 2021-01-19 10:50

    Are there any Copy Files phases?

    Is the Prefix.pch.gch file in your project's group tree? The easiest way to check this would be to select the project object, then search for “gch” in the Detail view.

    0 讨论(0)
  • 2021-01-19 10:51

    I solved this problem in a different way. Firstly I like to make use of the prefix file so I have lots of includes for standard logging, colours etc.

    For every include to the prefix file ensure that each include is only processed once! This can be done by putting:

    #ifndef __<Classname>__
    #define __<Classname>__ 
    
    < your original header file here >
    
    #endif
    
    0 讨论(0)
  • 2021-01-19 10:53

    You could try doing "Show Package Contents" on your xcode project file in the finder, then opening the project.pbxproj file in a text editor (not xcode).

    If you search for ".pch" and/or ".gch", you might spot something.

    0 讨论(0)
  • 2021-01-19 10:58

    If you select the "Project" item of the "Project menu and then the "Detail" tab view and then select the project in the "Groups & Files" list on the left is the files listed on the right view have a checkbox? and is that checkbox checked? if so then un-check it.

    0 讨论(0)
提交回复
热议问题