Re: External C function and duplicate symbol
Re: External C function and duplicate symbol
- Subject: Re: External C function and duplicate symbol
- From: Scott Andrew <email@hidden>
- Date: Fri, 3 Oct 2008 05:32:45 -0700
What about using #pragma once at the top of the header file? The other
solution is to move the functions to a C file and move just the
function definitions to header files. I prefer the second for
readability. I usually have a utils.c and a utils.h. I'm not a big fan
of function implementations in header files.
Scott
On Oct 3, 2008, at 4:19 AM, Christian Giordano wrote:
Hi guys, I've few functions that I'm keeping on an external .h file.
If the header is included in more than a class I get duplicate symbol
error. I tried using #ifndef which I use on my C++ classes but didn't
bring any luck. I had a look to the various headers in the framework
and I saw they use the following sintax:
#define VEC_ZERO_2(a) \
{ \
(a)[0] = (a)[1] = 0.0; \
}
Isn't there a way to achieve the same but having parameters and
returns typed?
Thanks, chr
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden