[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: More newbie questions (problems with drand48)
From: |
BENEDIKT STEFANSSON |
Subject: |
Re: More newbie questions (problems with drand48) |
Date: |
Fri, 22 Jan 1999 17:44:42 -0800 (PST) |
Hi,
I forget the details, but in all likelihood the drand48() is not
part of the standard C-libraries in the Cygwin stuff. Try substituting
the following line for the "randnum=drand48" line:
randnum=(double)rand()/INT_MAX;
Also make sure that the header file imports these two files:
#import <stdlib.h>
#import <limits.h>
Hope this works,
-Benedikt
PS. By the way the "jibberish" is just the compiler telling you that it is
compiling the objects and linking to create the executable.
----------------
Benedikt Stefansson address@hidden
Department of Economics, UCLA Fax. (310) 825-9528
Los Angeles, CA 90095-1477 Tel. (310) 825-1777
On Fri, 22 Jan 1999, Joseph E. Villa wrote:
> Greetings,
>
> I've got swarm-1.3.1 running on a NT4.0 machine under Cygwin19. I'm
> trying to work my way through Benedikt Stefansson's Swarm Tutorial. I'm
> wedged on the first example (SimpleCBug) and thought that I would see if
> anyone had thoughts or coaching.
>
> I've installed Cygwin in c:\Cygnus and swarm in c:\Swarm-1.3.1. I've
> copied the text of main.m verbatim. I've copied the content of makefile
> and modified as follows:
>
> ++++ begin ++++
>
> SWARMHOME=c:\swarm-1.3.1
> APPLICATION=bug
> OBJECTS= main.o
> include $(SWARMHOME)\packages\swarm\etc\swarm\makefile.appl
>
> main.o: main.m
>
> ++++ end ++++
>
>
> The main.m file includes the following snippet:
>
> ++++ begin ++++
>
> random_move() {
> double randnum;
>
> randnum = drand48();
>
> if (randnum <= 0.33333) return -1;
> else if (randnum <= 0.6667) return 0;
> else return 1;
>
> }
>
> ++++ end ++++
>
>
> When I enter make, I get the following:
>
> ++++ begin ++++
>
> /Swarm-1.3.1/packages/swarm/bin/libtool-swarm --mode link gcc -g -O2
> -fno-inline -L/Swarm-1.3.1/packages/swarm/lib
> -Wl,-rpath,/Swarm-1.3.1/packages/swarm/lib
> -L/Swarm-1.3.1/packages/BLT/lib -L/Cygnus/B19/H-i386-cygwin32/lib
> -L/Cygnus/B19/H-i386-cygwin32/lib -L/Swarm-1.3.1/packages/libffi/lib
> -L/Swarm-1.3.1/packages/png/lib -L/Swarm-1.3.1/packages/zlib/lib -o
> bug.exe main.o -lspace -lanalysis -lsimtools -lsimtoolsgui -ltkobjc
> -ltclobjc -lactivity -lrandom -lobjectbase -lcollections -ldefobj -lmisc
> -lBLT80 -ltk80 -ltcl80 -lpng -lz -lffi -luser32 -lgdi32 -lm -lobjc
> gcc -g -O2 -fno-inline -L/Swarm-1.3.1/packages/swarm/lib
> -Wl,-rpath,/Swarm-1.3.1/packages/swarm/lib
> -L/Swarm-1.3.1/packages/BLT/lib -L/Cygnus/B19/H-i386-cygwin32/lib
> -L/Cygnus/B19/H-i386-cygwin32/lib -L/Swarm-1.3.1/packages/libffi/lib
> -L/Swarm-1.3.1/packages/png/lib -L/Swarm-1.3.1/packages/zlib/lib -o
> bug.exe main.o -lspace -lanalysis -lsimtools -lsimtoolsgui -ltkobjc
> -ltclobjc -lactivity -lrandom -lobjectbase -lcollections -ldefobj -lmisc
> -lBLT80 -ltk80 -ltcl80 -lpng -lz -lffi -luser32 -lgdi32 -lm -lobjc
>
> main.o: In function 'random_move':
> /Swarm-1.3.1/main.m:48: undefined reference to 'drand48'
> make: *** [bug.exe] Error 1
>
> ++++ end ++++
>
> I don't know that all the first jibberish is. But the second part is, I
> infer, not good. And, of course, there is no bug.exe. My assumption had
> been that drand48 was a function that was defined in either <simtools.h>
> (imported) or <stdlib.h> (included). When I examine these, however, I do
> not find drand48.
>
> Does anyone, perchance, have any thoughts on the nature of my problem or
> failure?
>
> Cheers,
>
> Joseph Villa
>
> ==================================
> 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.
>
==================================
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.