Interesting. I've not tried this one for a while. Now, with gcc3, we are
getting warnings about many small errors that were ignored by gcc-2.96
Follow the error. Look at line 126 in Species.m.
Think to myself, "where is the compiler supposed to find the program "exit"?"
Hmm.
Lets go looking
$ cd /usr/include
$ grep exit s*
In that output I spot:
stdlib.h:extern void exit (int __status) __THROW __attribute__
((__noreturn__));
So if at the top of Species.m, I insert an include for that, everything is OK:
#import <stdlib.h>
But then I was remembering that Swarm includes a "catch all" header
file "misc.h" and it includes stdlib.h, so instead of using that import,
you can also do:
#import <misc.h>
-----------------------
Now, to save you some trouble and another message to the list, here is
what happens when the compile continues:
gcc3 -c -g -O2 -march=i386 -mcpu=i686 -Wall -Wno-import -Wno-protocol
-Werror -D_GNU_SOURCE -DAPPNAME=arborgames -DAPPVERSION=2.1
address@hidden -I/usr/include/swarm ForestObserverSwarm.m
cc1obj: warnings being treated as errors
ForestObserverSwarm.m: In function `-[ForestObserverSwarm _drawGraphs:]':
ForestObserverSwarm.m:333: warning: multiple declarations for method `step'
ForestModelSwarm.h:35: warning: using `-step'
/usr/include/swarm/analysis.h:591: warning: also found `-(void)step'
/usr/include/swarm/analysis.h:564: warning: also found `-(void)step'
/usr/include/swarm/analysis.h:541: warning: also found `-(void)step'
ForestObserverSwarm.m:338: warning: multiple declarations for method `step'
ForestModelSwarm.h:35: warning: using `-step'
/usr/include/swarm/analysis.h:591: warning: also found `-(void)step'
/usr/include/swarm/analysis.h:564: warning: also found `-(void)step'
/usr/include/swarm/analysis.h:541: warning: also found `-(void)step'
ForestObserverSwarm.m:344: warning: multiple declarations for method `step'
ForestModelSwarm.h:35: warning: using `-step'
/usr/include/swarm/analysis.h:591: warning: also found `-(void)step'
/usr/include/swarm/analysis.h:564: warning: also found `-(void)step'
/usr/include/swarm/analysis.h:541: warning: also found `-(void)step'
make: *** [ForestObserverSwarm.o] Error 1
make: Target `all' not remade because of errors.
Compilation exited abnormally with code 2 at Tue Dec 10 07:47:44
--------------------------------------
Note that in ForestModelSwarm.h, there is a method declared
-step;
But that does not match the declaration of step that we now have in the
swarm libraries. You see in the error messages, the libraries have
- (void)step;
and you can't introduce a method with the same name unless the declaration
is exactly the same.
-(void)step {
int total, i ;
total = 0 ;
for(i = 0 ; i < speciesNumber ; i++)
total += [[speciesList atOffset: i] getCount] ;
for(i = 0 ; i < speciesNumber ; i++)
[[speciesList atOffset: i] setTotalNumberOfTrees: total] ;
// return self ;
}
After making corresponding changes in several of the files in this
package, I get a clean compile and it runs just the way I remember it.
I will put the fixed version up in ftp sometime soon, but why not try this
on your own? If you try edit/compile in Emacs, it is easy work, and you
will learn something.
Li An wrote:
Hi,
I tried to run make command at the arborgames-2.1 directory after I
changed the SWARMHOME to /usr, but have the following warning--still a
mismatch problem? how to fix the problem? Thanks. Li
address@hidden arborgames-2.1]$ make
gcc3 -c -g -O2 -march=i386 -mcpu=i686 -Wall -Wno-import -Wno-protocol
-Werror -D_GNU_SOURCE -DAPPNAME=arborgames -DAPPVERSION=2.1
address@hidden -I/usr/include/swarm Species.m
cc1obj: warnings being treated as errors
Species.m: In function `-[Species getLevelAtAge:]':
Species.m:126: warning: implicit declaration of function `exit'
make: *** [Species.o] Error 1
Li An
Systems Modeling Lab
--
Paul E. Johnson email: address@hidden
Dept. of Political Science http://lark.cc.ku.edu/~pauljohn
University of Kansas Office: (785) 864-9086
Lawrence, Kansas 66045 FAX: (785) 864-5700
==================================
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.