[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: REPOST: compiler error passing method
From: |
Ken Cline |
Subject: |
Re: REPOST: compiler error passing method |
Date: |
Mon, 4 Aug 1997 18:00:27 -0400 (EDT) |
On Mon, 4 Aug 1997, Steve Emsley wrote:
> -(void) test {
> double tmp;
> tmp = [lightSpace spectral: 50];
> printf("%d\n",tmp);
> return;
> }
>
> I get the error message:
>
> OModel.m: In function `_i_POModel__test':
> POModel.m:665: warning: cannot find method.
> POModel.m:665: warning: return type for `spectral:' defaults to id
> POModel.m:665: incompatible types in assignment
> POModel.m:666: warning: int format, double arg (arg 2)
> make: *** [POModel.o] Error 1
Some things to try:
1. Check that `spectral' is defined in LightTable.h
(or a superclass)
2. Check that the return type for `spectral' is double
3. Check that LightTable.h is imported into
POModel.m, either
- directly into POModel.m
OR
- into POModel.h *and* then POModel.h is
imported into POModel.m
4. Change `test' as follows
-(void) test {
double tmp;
tmp = (double)[lightSpace spectral: 50];
// ^^^^^^ -- casting just to be safe
printf("%e\n",tmp);
// ^ -- print `tmp' as a double OR
printf("%d\n",(int)tmp);
// ^ ^^^ -- print `tmp' as an int
return;
}
5. Alternately, make `tmp' an id and cast in the printf
statement.
The fact that the compiler cannot find `spectral' appears to
be what is causing make to fail. The other warnings should
not cause the compilation to fail but should still be
corrected.
I hope this helps.
Ken.
_________________________________________________________
Ken Cline address@hidden
SAIC VOICE (410) 571-0413
Annapolis, MD FAX (301) 261-8427
==================================
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.
==================================