Forced include with Xcode

Discussion in 'Mac Programming' started by eddyq, Aug 11, 2009.

  1. eddyq macrumors member

    Joined:
    Jun 10, 2009
    #1
    I'm porting an application that requires a configuration .h depending on the customer. To accomplish that I used a feature called "Forced include" where one can enter something like foo/customer.h. For Xcode I can't see any place where that can be done. Am I missing something?
     
  2. astroboi macrumors member

    Joined:
    Aug 10, 2007
    Location:
    Melbourne, Down Under
    #2
    When you start a new project in xcode it creates a "prefix header" called <appname>_Prefix.pch. This gets prefixed to all source files in the project.. so you could add an include in there and it would propagate to all your source files. Is that what you want?
     
  3. eddyq thread starter macrumors member

    Joined:
    Jun 10, 2009
    #3
    The project I created is for a KEXT. It did not create a _Prefix.pch file. So I created one manually but the build did not pick it up. Any ideas?
     
  4. eddyq thread starter macrumors member

    Joined:
    Jun 10, 2009
    #4
    This Xcode has some growing to do if it ever wants to catch up with Developer Studio which is used by Windows.
     
  5. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #5
    Not really. You would have the same issues in Visual Studio as you do in Xcode. You just need to learn how each application does things.

    The Xcode Users Manual is pretty comprehensive when it comes to things like this.
     
  6. astroboi macrumors member

    Joined:
    Aug 10, 2007
    Location:
    Melbourne, Down Under
    #6
    In the target info, under the Build tab, check the "Prefix Header" option under the "GCC 4.2 - Language" section. This should be set to the name of your .pch file. I also have the "Precompile Prefix Header" option ticked. I haven't done any KEXT programming so I'm not sure if there are differences with how .pch files are treated.
     
  7. gnasher729 macrumors P6

    gnasher729

    Joined:
    Nov 25, 2005
    #7
    You would complain just as much if you tried to figure out how Developer Studio does something that you've always be able to do with XCode. Actually, from experience, you would be bitching an awful lot more because you would find a lot more to bitch about.
     
  8. der.moze macrumors newbie

    Joined:
    Nov 28, 2014
    #8
    old post but the correct answer was still missing:
    use the "-include some header.h" of the compiler in "Other C Flags" field..

    And as side-note:
    I hate being pro-microsoft, but in the question of VC vs Xcode there is no question.
    If you really a lot work with both, there are also some features form Xcode you begin to miss in VC, but the other way around there are a big big lot more... And I'm not talking about explicit fields in the config for "force include" but basic necessities in the expression watch and alike...
     

Share This Page