am I doing something wrong here?
am I doing something wrong here?
- Subject: am I doing something wrong here?
- From: Markian Hlynka <email@hidden>
- Date: Wed, 9 Jun 2004 22:31:03 -0600
I have a file, foo.h, and a foo.c
foo.c:
somefunction()
{
bar();
}
foo.h:
#ifndef FOOH
#define FOOH
void bar(int &i)
{
i = a bunch of math;
}
#endif
This produces 2 errors upon build: (the actual funciton is called
CalculateElapsedTime)
codegeneration:0: multiple definitions of symbol
_Z20CalculateElapsedTimeR12__MyTimeData.eh
codegeneration:0: multiple definitions of symbol
CalculateElapsedTime(__MyTimeData&)
I can solve this problem in one of 2 ways:
1. make the function in the .h file begin:
inline void bar(int& i){...
2. Make the .h file have a prototype,
void bar(int& i);
and make the .c file include the body of the function.
Now, these both make sense, but am I doing something wrong the first
way? It worked with zerolink on, but with zerolink off it generated
these warnings. (yes, I did a clean) And this is on-topic for x-code
because I'm not sure if the error is mine or xcode's!
I was under the impression that including a function in a header file
without the inline keyword would give the compiler the option of
inlining it, but not the requirement.
Thanks,
Markian
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.