Discussion:
[Mingw-users] undefined reference to `srandom'
l***@donet.com
2000-12-31 09:24:58 UTC
Permalink
Any ideas on this error message, I am compiling a program that uses the
splotch AI engine, and I get the following output..

splotch.o(.text+0x137):splotch.c: undefined reference to `random'
splotch.o(.text+0x191):splotch.c: undefined reference to `random'
splotch.o(.text+0x36c):splotch.c: undefined reference to `srandom'
splotch.o(.text+0x672):splotch.c: undefined reference to `random'
splotch.o(.text+0x1295):splotch.c: undefined reference to `random'


This program compiles fine under linux and cygwin, but I am trying to
compile under mingw .. any clues? here is a section of code that uses the
"random" function out of splotch.c

else {

if ((random() % 100)+1)
usetempl(maxtempl);
else {
i = (random() % SP_HIST);
i = oldkeywd[i];
if (DEBUG)
fprintf(stderr, "<<SP_HIST used, i=%i>>\n",i);


if (i < 0)
usetempl(maxtempl);
else usetempl(i);
}
Paul Garceau
2001-01-01 04:50:12 UTC
Permalink
Hi folks,
Post by l***@donet.com
Any ideas on this error message, I am compiling a program that
uses the splotch AI engine, and I get the following output..
splotch.o(.text+0x137):splotch.c: undefined reference to `random'
splotch.o(.text+0x191):splotch.c: undefined reference to `random'
splotch.o(.text+0x36c):splotch.c: undefined reference to
`srandom' splotch.o(.text+0x672):splotch.c: undefined reference
to `random' splotch.o(.text+0x1295):splotch.c: undefined
reference to `random'
Try using srand() and rand(). Afaik, there is no such thing as
random() implemented under mingw.

Peace,

Paul G.
Post by l***@donet.com
This program compiles fine under linux and cygwin, but I am
trying to compile under mingw .. any clues? here is a section of
code that uses the "random" function out of splotch.c
else {
if ((random() % 100)+1)
usetempl(maxtempl);
else {
i = (random() % SP_HIST);
i = oldkeywd[i];
if (DEBUG)
fprintf(stderr, "<<SP_HIST used, i=%i>>\n",i);
if (i < 0)
usetempl(maxtempl);
else usetempl(i);
}
Nothing real can be threatened.
Nothing unreal exists.

Loading...