[comp.sys.mac.programmer] problem with using C++'s inline

pje@h.gp.cs.cmu.edu (Paul Erion) (01/23/91)

i'm perplexed.  i'm trying to use "inline" without much success.

definition of the member function:

   inline TEditCommand*  TMiddleSnake::FwdEdit (void)
   {
	return fFwdEdit;  // "fFwdEdit" is a private member of this class
   }

the linker error is:
    ### Link: Error:
	Undefined entry, name: (Error 28) "FwdEdit__12TMiddleSnakeFv"
    Referenced from:
	PushLowerRight__5TDiffFP10TEditGraphP12TMiddleSnakeiP10TInfoStack
	in file: :Obj:Diff.cp.o

anyone have any idea about what sort of silly thing i'm doing wrong?

					thanks,
						paul

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

INTERNET: pje@cs.cmu.edu
UUCP:	  ...!seismo!cs.cmu.edu!pje
USPS:	  paul erion, c/o school of comp sci, cmu, pittsburgh, pa 15213-3890
phone:	  (412) 268-3680

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

rae@gpu.utcs.toronto.edu (Reid Ellis) (01/27/91)

Sounds like you're using inline A in inline B before inline A is
defined.  i.e., something like this:
---
1	struct Tfoo {
2		int &	get();
3		void	doSomething();
4	private:
5		int i;
6	};
7	
8	inline void	Tfoo::doSomething()	{ get()++; }
9	inline int &	Tfoo::get()		{ return i; }
---
The trick is to change lines 2 and 3 to
---
2		inline int &	get();
3		inline void	doSomething();
---

which tells the compiler that these methods are both inline, so it
won't look for the symbol for the inline.

Hope this helps..
					Reid
--
Reid Ellis  176 Brookbanks Drive, Toronto ON, M3A 2T5 Canada
rae@gpu.utcs.toronto.edu      ||  rae%alias@csri.toronto.edu
CDA0610@applelink.apple.com   ||             +1 416 446 1644