Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

eddyq

macrumors member
Original poster
Jun 10, 2009
96
0
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?
 

astroboi

macrumors member
Aug 10, 2007
35
0
Melbourne, Down Under
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?
 

eddyq

macrumors member
Original poster
Jun 10, 2009
96
0
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?
 

eddyq

macrumors member
Original poster
Jun 10, 2009
96
0
This Xcode has some growing to do if it ever wants to catch up with Developer Studio which is used by Windows.
 

Cromulent

macrumors 604
Oct 2, 2006
6,802
1,096
The Land of Hope and Glory
This Xcode has some growing to do if it ever wants to catch up with Developer Studio which is used by Windows.

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.
 

astroboi

macrumors member
Aug 10, 2007
35
0
Melbourne, Down Under
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?

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.
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,565
This Xcode has some growing to do if it ever wants to catch up with Developer Studio which is used by Windows.

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.
 

der.moze

macrumors newbie
Nov 28, 2014
1
0
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...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.