Thread overview | ||||||
---|---|---|---|---|---|---|
|
September 11, 2002 File identifier error | ||||
---|---|---|---|---|
| ||||
the following error: test.d(5): identifier 'File' is not defined was generated when I trued to compile the following code: import string; import file; int main (char[][] args) { File file = new File; file.create('test.dat'); int a = 0, b = 1; for (int i = 0; i < 1000; i++) { int c = a + b; file.write(c); a = b; b = c; } return 0; } how would I go about addressing this problem? |
September 12, 2002 Re: File identifier error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrew Edwards | "Andrew Edwards" <crxace13@comcast.net> wrote in news:aloj8o$1qjj$1 @digitaldaemon.com:
> the following error:
> test.d(5): identifier 'File' is not defined
> was generated when I trued to compile the following code:
>
> import string;
> import file;
> int main (char[][] args)
> {
> File file = new File;
> file.create('test.dat');
> int a = 0, b = 1;
> for (int i = 0; i < 1000; i++)
> {
> int c = a + b;
> file.write(c);
> a = b; b = c;
> }
> return 0;
> }
>
Don't have variable names the same as imports.
|
September 12, 2002 Re: File identifier error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrew Edwards | Andrew Edwards wrote:
> the following error:
> test.d(5): identifier 'File' is not defined
> was generated when I trued to compile the following code:
>
> import string;
> import file;
class File is defined in stream.d, not in file.d
|
September 12, 2002 Re: File identifier error | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | Thanks Pavel, I imported the wrong file. String vs Stream. BTW the problem with the unittest in stream.d is that the string "Testing stream.d:" contains 17 characters, not 18. "Pavel Minayev" <evilone@omen.ru> wrote in message news:alp2aq$29um$1@digitaldaemon.com... | Andrew Edwards wrote: | > the following error: | > test.d(5): identifier 'File' is not defined | > was generated when I trued to compile the following code: | > | > import string; | > import file; | | class File is defined in stream.d, not in file.d | |
Copyright © 1999-2021 by the D Language Foundation