|
From: | Bill Northcott |
Subject: | Re: [Swarm-Support] Swarm on Mac |
Date: | Tue, 6 Feb 2007 21:22:21 +1100 |
On 06/02/2007, at 6:12 PM, David Camacho Trujillo wrote:
Many thanks Bill! You are right, Here is the code: // Copyright ? 1995-2000 Swarm Development Group. // No warranty implied, see LICENSE for terms. #import "BinChrom.h" #include <sys/types.h> #include <malloc.h> #include <random.h> unsigned char Wgts[9] = { 0,128,64,32,16,8,4,2,1 }; // 1st number does not mind @implementation BinChromosome
This is an “old” code from another user contribution. It is a GA (Breeder2.1) I am working with, and I did not feel confident enough to change it since it wasrunning fine under the other architectures.
This code is wrong. It might work on some architectures, but it author needs to read K&R. On many UNIXen including MacOS malloc.h is not in the default header search path. Including stdlib.h includes types.h and malloc.h wherever they are. This is the right thing to do and the code is wrong.
Now I put "stdlib.h" instead and compiles, but seems like I need to update more code, now says: ./gamodel Version -1599647552 doesn't match runtime protocol version 2 Abort trap
Make sure you did a make clean or otherwise removed all the old build products.
Of course none of this is anything to do with Swarm. It is just C programming 101.
Bill
[Prev in Thread] | Current Thread | [Next in Thread] |