Re: Weird error situation
Re: Weird error situation
- Subject: Re: Weird error situation
- From: Chris Espinosa <email@hidden>
- Date: Sun, 23 Sep 2007 22:10:06 -0700
On Sep 23, 2007, at 9:57 PM, Adam wrote: ...but I have #pragma once at the top! Doesn't that pretty much fix the problem? I used Cris Suter's advice and slapped an "extern" on the ones that it said were having a problem, and bingo! it's fixed. The only thing now is that it's giving me warnings about some bool functions that I have:
No, that just means it only gets processed once per compilation unit. Not once per build. Every C++ file you compile has to read the header file at least (and preferably only) once, but each gets a definition of the global, then when you link all the compilation units together, you've defined each global three times.
Look, it's simple:
- declare as extern in a .h protected by a header guard or #pragma once - define in a .cp file that you build exactly once per linked executable - #include the .h file from the source file that defines it, as well as every other source file that uses it
This is elementary C.
Chris |
_______________________________________________
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