swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help on compiler messages


From: Ken Cline
Subject: Re: Help on compiler messages
Date: Tue, 02 Feb 1999 20:33:14 -0500

Benedikt Stefansson wrote:
> 
> Fabio,
> 
> > The point is that during compiling, the compiler complains that...
> >
> > Bug.m: in function '-[bug step]'
> > Bug.m:75: warning: cannot find method
> > Bug.m:75: warning: return type for 'kill:' defaults to id
> >
> 
> > Why this warning and what should I do to make it disappear(should I
> > import "ModelSwarm.h" in "Bug.h" an declare myModel as a variable of
> > Type ModelSwarm instead of generic type id)?
> 
> First of all, as you indicated the warning is benign, since you know
> that at runtime the ModelSwarm instance will be found and the -kill
> method executed correctly.
> 
> In general your suggested fix is correct, that is you could import
> ModelSwarm.h in Bug.h and declare ModelSwarm * myModel. In practice
> however this might give you additional problems, because now Bug.h is
> imported in ModelSwarm.h and vice versa. This will make the compiler
> profoundly unhappy and cause it to refuse to compile (in addition the
> error message is usually completely uniformative).
> 
> I have yet to find a general solution to the problem, it is often more
> work than it is worth, i.e. you have to use protocols and dynamically
> type the receiving object (myModel). This fix wouldn't work in this
> case.

Another alternative that might work [hmmm... its been awhile...] is to
import ModelSwarm.h in Bug.m instead of Bug.h; that should prevent the
cyclic include/import problem which the precompiler is offended by.

If you are statically typing myModel in Bug.h (ie ModelSwarm * myModel)
then you'll probably need to use the @class notation to keep the
precompiler quiet when it parses the header files.  (Sorry, I can't
remember the exact syntax for doing this, but you should be able to
find some examples in the Swarm source or other reference manual. ;-)

Ken.

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]