| delorie.com/archives/browse.cgi | search |
| From: | dontmailme AT iname DOT com (Steamer) |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Which library is time in? |
| Date: | Wed, 05 Jul 2000 14:00:22 GMT |
| Organization: | always disorganized |
| Lines: | 25 |
| Message-ID: | <39633f53.24462774@news.freeserve.net> |
| References: | <4vG85.7238$MS3 DOT 148292 AT news1 DOT online DOT no> |
| NNTP-Posting-Host: | modem-73.chromis.dialup.pol.co.uk |
| X-Trace: | newsg4.svr.pol.co.uk 962805623 9047 62.136.245.73 (5 Jul 2000 14:00:23 GMT) |
| NNTP-Posting-Date: | 5 Jul 2000 14:00:23 GMT |
| X-Complaints-To: | abuse AT theplanet DOT net |
| X-Newsreader: | Forte Free Agent 1.11/32.235 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Geek86 wrote:
> I looked at the DJGPP FAQ 22.23(How to produce random numbers) and it told
> me to set the srand by using the computer clock like this:
> srand(time(NULL));
If the code is intended to be portable then it's probably better to do
srand((unsigned)time(NULL));
to prevent warnings on some compilers.
> But when I try to compile I get the error "called object is not a function".
> I assume its because I havent included the right library (?). Which library
> should I include?
In DJGPP, it's in libc.a, which is automatically used during linking.
You should #include <time.h> to get the appropriate prototype.
But your error message is caused by having a different definition (or
declaration) of time (or perhaps of srand) elsewhere in your code.
Seek it out with grep and change it to something that doesn't conflict
with a standard function.
S.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |