• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Precompiled header problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Precompiled header problem


  • Subject: Re: Precompiled header problem
  • From: "Jeff Schmidt" <email@hidden>
  • Date: Tue, 25 Apr 2006 12:32:14 -0500

On Apr 25, 2006, at 12:17 PM, Chris Espinosa wrote:
Well, there's a very simple explanation. const definitions are code, and gcc stops precompiling headers when it reaches the first line of code.

Precompiled headers are applied as a prefix to every source file in your target. So if gcc emitted code for these const definitions in the pch, you'd have multiple definitions of the constants, one for every source file. The linker wouldn't like that.

You have two choices:

1) Use macros instead of const declarations.
2) Declare the consts as "extern" in your precompiled header, and do the formal definitions in a single source file in your build (not in a header file or the prefix file).

So why would this header work when included in a PCH for some projects, but not this one? If I'm understanding your description of gcc precompilation, I'd expect it to fail wherever it's used in that way. I don't find that to be the case.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >Precompiled header problem (From: "Jeff Schmidt" <email@hidden>)
 >Re: Precompiled header problem (From: Chris Espinosa <email@hidden>)

  • Prev by Date: Re: Precompiled header problem
  • Next by Date: Re: Building Universal IOKit Drivers
  • Previous by thread: Re: Precompiled header problem
  • Next by thread: Re: DEPLOYMENT_POSTPROCESSING = YES doesn't apply permissions to copied directories?
  • Index(es):
    • Date
    • Thread