Removing the template generated .pch file?

Discussion in 'iOS Programming' started by DUMBDOG, Aug 22, 2009.

  1. DUMBDOG macrumors newbie

    Oct 29, 2008
    I was wondering if there is a way to remove the .pch file from an iPhone project and still have it build correctly?

    I assumed it wouldnt be that hard, but after searching the net for a couple hours I havent found a solution.

    Basically, as you probably know, when creating a new iPhone project, it will automatically generate the pre-compiled header file. I would like to remove that file altogether, but the problem is when I delete the file I get the errors:
    Line Location Chilias_Animal_House_Prefix.pch:0: i686-apple-darwin9-gcc-4.2.1: warning: '-x objective-c-header' after last input file has no effect
    Line Location Chilias_Animal_House_Prefix.pch:0: i686-apple-darwin9-gcc-4.2.1: no input files
    Line Location Chilias_Animal_House_Prefix.pch:0: i686-apple-darwin9-gcc-4.2.1: /Users/iphonedevelopment/Desktop/cwd-Chilias.Animal.House/Chilias_Animal_House_Prefix.pch: No such file or directory
    Line Location Chilias_Animal_House_Prefix.pch:0: Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
    Where "Chilias_Animal_House" is my project name. So Im thinking that there is some option deep within the project settings that I can modifiy to get it to stop looking for this file, but I cant seem to find it.

    Does anyone know how to get around this?

  2. kainjow Moderator emeritus


    Jun 15, 2000
    The file is referenced in a Build setting for your project's target. I don't know the exact name off hand but if you Get Info your target and go to the Build tab, search for "pre-compiled" (or similar) and it should come up.

    Why do you want to remove it?
  3. Troglodyte macrumors member

    Jul 2, 2009
    Why do you want to remove it? Unless you've got a good reason it's best to leave stuff alone.
  4. DUMBDOG thread starter macrumors newbie

    Oct 29, 2008
    I want to remove it because I dont like IDE's putting unnecesary garbage into my project's that I dont fully understand.

    Basically, until I understand what and why an IDE does something for me, and how I can replicate that functionality without the IDE automatically doing it for me, I prefer to do without it. Thats the main reason why I prefer to simply use gcc and makefiles for compilation and linking. But as far as I know, thats not possible for programming on the iPhone.

    Is that a wrong way of going about things?

    do you perhaps know of the specific build setting? Ive tinkered a bit with it, and havent found any success. And I dont really want to change too much without knowing what Im doing.
  5. admanimal macrumors 68040

    Apr 22, 2005
    A .pch file is a pre-compiled header that the compiler uses to speed up compilation by avoiding having to re-compile large headers every time they are included in a source file. There is no logical reason to not allow Xcode to do this. It isn't writing any mysterious code and adding it to your program, it's just creating an intermediate file that speeds up compilation.
  6. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    It's necessary and it's not garbage. That help? :D
  7. `lowell` macrumors newbie

    Aug 20, 2009
    San Diego
    looking for this?


    double click on the target; it's there. it'll build if you delete that and the file.


    absolutely not; experimentation and exploration are great ways to learn.

Share This Page