Thread overview | ||||||
---|---|---|---|---|---|---|
|
November 02, 2016 error | ||||
---|---|---|---|---|
| ||||
void main(string[] args) { srand(time(null)); int p1 = rand() % 7; p1++; i compiled this program i wrote... but it keeps giving me an error main.d(17): Error: undefined identifier 'time' can someone help me please? |
November 02, 2016 Re: error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Concealment | On Wednesday, 2 November 2016 at 01:27:32 UTC, Concealment wrote:
> can someone help me please?
did you import anything? `import core.stdc.stdlib;` I think will fix that one, but generally you need an import to use lib functions.
|
November 02, 2016 Re: error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Wednesday, 2 November 2016 at 01:32:27 UTC, Adam D. Ruppe wrote:
> On Wednesday, 2 November 2016 at 01:27:32 UTC, Concealment wrote:
>> can someone help me please?
>
> did you import anything? `import core.stdc.stdlib;` I think will fix that one, but generally you need an import to use lib functions.
yea i did import core.stdc.stdlib; but it still gives me the same error
|
November 01, 2016 Re: error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Concealment | On Wednesday, November 02, 2016 01:36:23 Concealment via Digitalmars-d-learn wrote:
> On Wednesday, 2 November 2016 at 01:32:27 UTC, Adam D. Ruppe
>
> wrote:
> > On Wednesday, 2 November 2016 at 01:27:32 UTC, Concealment
> >
> > wrote:
> >> can someone help me please?
> >
> > did you import anything? `import core.stdc.stdlib;` I think will fix that one, but generally you need an import to use lib functions.
>
> yea i did import core.stdc.stdlib; but it still gives me the same error
It's in core.stdc.time. The druntime modules are supposed to correspond to the C header files, and time is in time.h, not stdlib.h.
- Jonathan M Davis
|
Copyright © 1999-2021 by the D Language Foundation