• 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
am I doing something wrong here?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Prev by Date: Re: Strange Instruction Pointers
  • Next by Date: Re: ZeroLink: when to use
  • Previous by thread: Re: prototypes in function popup menu
  • Next by thread: HeaderDoc 8 vs. doxygen
  • Index(es):
    • Date
    • Thread