www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - why

reply freud <freud_member pathlink.com> writes:
why do i always get a "xx.d:module xx cannot read file xx.d" when i compile
xx.d?  i'm just beginning to learn the d language, anyone can help me ?
Jul 02 2006
next sibling parent "Derek Parnell" <derek psych.ward> writes:
On Sun, 02 Jul 2006 17:35:24 +1000, freud <freud_member pathlink.com>  
wrote:

 why do i always get a "xx.d:module xx cannot read file xx.d" when i  
 compile
 xx.d?  i'm just beginning to learn the d language, anyone can help me ?
I can't reproduce this effect. Can you show us the source code of xx.d, the command line you use to compile it, and the contents of dmd\bin\sc.ini file? -- Derek Parnell Melbourne, Australia
Jul 02 2006
prev sibling next sibling parent reply Frank Benoit <keinfarbton nospam.xyz> writes:
freud schrieb:
 why do i always get a "xx.d:module xx cannot read file xx.d" when i compile
 xx.d?  i'm just beginning to learn the d language, anyone can help me ?
 
 
The module statement and the actual location and name of your source file do not match. in Folder 'a', file 'b.d': module a.b;
Jul 02 2006
parent "Derek Parnell" <derek psych.ward> writes:
On Sun, 02 Jul 2006 21:01:18 +1000, Frank Benoit <keinfarbton nospam.xyz>  
wrote:

 freud schrieb:
 why do i always get a "xx.d:module xx cannot read file xx.d" when i  
 compile
 xx.d?  i'm just beginning to learn the d language, anyone can help me ?
The module statement and the actual location and name of your source file do not match. in Folder 'a', file 'b.d': module a.b;
Frank, can you show me some source code that will give this message? Note that the file name in the message is the same in all three places... XX.d(1):module XX cannot read file XX.d I can get the message in the form FILEONE.d(1):module FILETWO cannot read file FILETWO.d but not in the form reported. -- Derek Parnell Melbourne, Australia
Jul 02 2006
prev sibling parent reply Hasan Aljudy <hasan.aljudy gmail.com> writes:
freud wrote:
 why do i always get a "xx.d:module xx cannot read file xx.d" when i compile
 xx.d?  i'm just beginning to learn the d language, anyone can help me ?
 
 
Could be anything, but .. When it happens to me, it's because I'm using `build` and the module name doesn't match the file name.
Jul 02 2006
parent reply "Derek Parnell" <derek psych.ward> writes:
On Mon, 03 Jul 2006 03:30:06 +1000, Hasan Aljudy <hasan.aljudy gmail.com>  
wrote:

 freud wrote:
 why do i always get a "xx.d:module xx cannot read file xx.d" when i  
 compile
 xx.d?  i'm just beginning to learn the d language, anyone can help me ?
Could be anything, but .. When it happens to me, it's because I'm using `build` and the module name doesn't match the file name.
Well, I still can cause it to happen no matter method I choose. For example ... ---- main.d ---- module xyzzy; void main(){} ------------------ build main.d is successful. dmd main.d is successful. -- Derek Parnell Melbourne, Australia
Jul 02 2006
next sibling parent reply John Reimer <terminal.node gmail.com> writes:
Derek Parnell wrote:
 On Mon, 03 Jul 2006 03:30:06 +1000, Hasan Aljudy 
 <hasan.aljudy gmail.com> wrote:
 
 freud wrote:
 why do i always get a "xx.d:module xx cannot read file xx.d" when i 
 compile
 xx.d?  i'm just beginning to learn the d language, anyone can help me ?
Could be anything, but .. When it happens to me, it's because I'm using `build` and the module name doesn't match the file name.
Well, I still can cause it to happen no matter method I choose. For example ... ---- main.d ---- module xyzzy; void main(){} ------------------ build main.d is successful. dmd main.d is successful. --Derek Parnell Melbourne, Australia
The error was showing up when I mistakenly tried to import a module like so: -------------- module amod; struct foo {} -------------- module bmod; private import Amod; void main() {} --------------------- but this doesn't seem to produce the problem. It happened when I imported a library module with the first letter capitalized, though the actual module name was all lower case. I'm not sure which platform I was struggling with, but I think it was windows. I finally figured out that build was choking on the recognition of the capital letter. -JJR
Jul 02 2006
parent reply Derek Parnell <derek nomail.afraid.org> writes:
On Sun, 02 Jul 2006 16:12:53 -0700, John Reimer wrote:

 Derek Parnell wrote:
 On Mon, 03 Jul 2006 03:30:06 +1000, Hasan Aljudy 
 <hasan.aljudy gmail.com> wrote:
 
 freud wrote:
 why do i always get a "xx.d:module xx cannot read file xx.d" when i 
 compile
 xx.d?  i'm just beginning to learn the d language, anyone can help me ?
Could be anything, but .. When it happens to me, it's because I'm using `build` and the module name doesn't match the file name.
Well, I still can cause it to happen no matter method I choose. For example ... ---- main.d ---- module xyzzy; void main(){} ------------------ build main.d is successful. dmd main.d is successful. --Derek Parnell Melbourne, Australia
The error was showing up when I mistakenly tried to import a module like so: -------------- module amod; struct foo {} -------------- module bmod; private import Amod; void main() {} --------------------- but this doesn't seem to produce the problem. It happened when I imported a library module with the first letter capitalized, though the actual module name was all lower case. I'm not sure which platform I was struggling with, but I think it was windows. I finally figured out that build was choking on the recognition of the capital letter.
I believe that D is case-sensitive when it comes to module names. I know that these translate into case-insensitive file names in Windows but there's not much I can do about that, I guess. -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocrity!" 3/07/2006 10:16:49 AM
Jul 02 2006
parent reply John Reimer <terminal.node gmail.com> writes:
Derek Parnell wrote:
 On Sun, 02 Jul 2006 16:12:53 -0700, John Reimer wrote:
 
 Derek Parnell wrote:
 On Mon, 03 Jul 2006 03:30:06 +1000, Hasan Aljudy 
 <hasan.aljudy gmail.com> wrote:

 freud wrote:
 why do i always get a "xx.d:module xx cannot read file xx.d" when i 
 compile
 xx.d?  i'm just beginning to learn the d language, anyone can help me ?
Could be anything, but .. When it happens to me, it's because I'm using `build` and the module name doesn't match the file name.
Well, I still can cause it to happen no matter method I choose. For example ... ---- main.d ---- module xyzzy; void main(){} ------------------ build main.d is successful. dmd main.d is successful. --Derek Parnell Melbourne, Australia
The error was showing up when I mistakenly tried to import a module like so: -------------- module amod; struct foo {} -------------- module bmod; private import Amod; void main() {} --------------------- but this doesn't seem to produce the problem. It happened when I imported a library module with the first letter capitalized, though the actual module name was all lower case. I'm not sure which platform I was struggling with, but I think it was windows. I finally figured out that build was choking on the recognition of the capital letter.
I believe that D is case-sensitive when it comes to module names. I know that these translate into case-insensitive file names in Windows but there's not much I can do about that, I guess.
No, that's true. No problem. Just was useful for me to figure out the problem was. Now that I know, I'm careful. :) -JJR
Jul 02 2006
parent reply Derek Parnell <derek nomail.afraid.org> writes:
On Sun, 02 Jul 2006 18:34:03 -0700, John Reimer wrote:

 Derek Parnell wrote:
 On Sun, 02 Jul 2006 16:12:53 -0700, John Reimer wrote:
 
 Derek Parnell wrote:
 On Mon, 03 Jul 2006 03:30:06 +1000, Hasan Aljudy 
 <hasan.aljudy gmail.com> wrote:

 freud wrote:
 why do i always get a "xx.d:module xx cannot read file xx.d" when i 
 compile
 xx.d?  i'm just beginning to learn the d language, anyone can help me ?
Could be anything, but .. When it happens to me, it's because I'm using `build` and the module name doesn't match the file name.
Well, I still can cause it to happen no matter method I choose. For example ... ---- main.d ---- module xyzzy; void main(){} ------------------ build main.d is successful. dmd main.d is successful. --Derek Parnell Melbourne, Australia
The error was showing up when I mistakenly tried to import a module like so: -------------- module amod; struct foo {} -------------- module bmod; private import Amod; void main() {} --------------------- but this doesn't seem to produce the problem. It happened when I imported a library module with the first letter capitalized, though the actual module name was all lower case. I'm not sure which platform I was struggling with, but I think it was windows. I finally figured out that build was choking on the recognition of the capital letter.
I believe that D is case-sensitive when it comes to module names. I know that these translate into case-insensitive file names in Windows but there's not much I can do about that, I guess.
No, that's true. No problem. Just was useful for me to figure out the problem was. Now that I know, I'm careful. :) -JJR
This is a quote from the D documentation on modules ... "By convention, package and module names are all lower case. This is because those names have a one-to-one correspondence with the operating system's directory and file names, and many file systems are not case sensitive. All lower case package and module names will minimize problems moving projects between dissimilar file systems." Good advice to heed. -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocrity!" 3/07/2006 11:39:10 AM
Jul 02 2006
parent reply John Reimer <terminal.node gmail.com> writes:
Derek Parnell wrote:

 
 This is a quote from the D documentation on modules ...
 
 "By convention, package and module names are all lower case. This is
 because those names have a one-to-one correspondence with the operating
 system's directory and file names, and many file systems are not case
 sensitive. All lower case package and module names will minimize problems
 moving projects between dissimilar file systems."
 
 Good advice to heed.
 
Well, it may be good advice, but I consider it impractical since it's not at all consistent with the D language itself (where case sensitivity is the norm within source files). I think it's an ugly and limiting requirement (or convention). The naming of namespaces should be parallel to any other D convention. If this is a problem, then mapping D namespaces to the filesystem was not such a good idea, because this makes D more dependent on OS filesystem technology and schemes. That probably is not a future proof approach. Furthermore, contrary to the statement Walter makes there, I don't know of many file systems that are truly case insensitive, at least pertaining to those OSes that D is available on currently: win32 is the closest that comes to that. Even windows, though, allows files and directories to be named with uppercase and maintains the case state... Thus, as long as you remember to be consistent with filename casing, using uppercase in module names is not an issue on Windows. I consider the residual case insensitivity in Win32 a defect and a nasty side effect of the DOS era. If Windows is the only OS that makes keeping Walter's convention a "good idea", I'm not convinced. :) -JJR
Jul 02 2006
parent Walter Bright <newshound digitalmars.com> writes:
John Reimer wrote:
 Well, it may be good advice, but I consider it impractical since it's 
 not at all consistent with the D language itself (where case sensitivity 
 is the norm within source files).  I think it's an ugly and limiting 
 requirement (or convention).
It's a convention. But one will run into difficulty if doing things like naming one module "foo" and another module "Foo".
 The naming of namespaces should be parallel to any other D convention. 
 If this is a problem, then mapping D namespaces to the filesystem was 
 not such a good idea, because this makes D more dependent on OS 
 filesystem technology and schemes.  That probably is not a future proof 
 approach.
The convention will work with both case sensitive and case insensitive file systems. I don't foresee any other convention ever being used, but even if one is, I expect it can be dealt with.
 Furthermore, contrary to the statement Walter makes there, I don't know 
 of many file systems that are truly case insensitive, at least 
 pertaining to those OSes that D is available on currently: win32 is the 
 closest that comes to that.  Even windows, though, allows files and 
 directories to be named with uppercase and maintains the case state... 
 Thus, as long as you remember to be consistent with filename casing, 
 using uppercase in module names is not an issue on Windows.
That's true, but you still can't have a "Foo" and "foo" coexist.
 I consider the residual case insensitivity in Win32 a defect and a nasty 
 side effect of the DOS era.  If Windows is the only OS that makes 
 keeping Walter's convention a "good idea", I'm not convinced. :)
It's been a while since I've used VMS, but it was also case insensitive. So was OS/2. DOS, VMS, Windows, and OS/2 all trace back to DEC operating systems which were case insensitive. Linux, etc., all trace back to Unix which was case sensitive.
Jul 04 2006
prev sibling parent reply Hasan Aljudy <hasan.aljudy gmail.com> writes:
Derek Parnell wrote:
 On Mon, 03 Jul 2006 03:30:06 +1000, Hasan Aljudy 
 <hasan.aljudy gmail.com>  wrote:
 
 freud wrote:

 why do i always get a "xx.d:module xx cannot read file xx.d" when i  
 compile
 xx.d?  i'm just beginning to learn the d language, anyone can help me ?
Could be anything, but .. When it happens to me, it's because I'm using `build` and the module name doesn't match the file name.
Well, I still can cause it to happen no matter method I choose. For example ... ---- main.d ---- module xyzzy; void main(){} ------------------ build main.d is successful. dmd main.d is successful.
This will compile fine, but try it, for example, with two such modules, where one imports the other. I'm not saying it's build's fault by the way .. because it's not. But this has happened to me before, when module names don't correctly match to their file names.
Jul 02 2006
parent reply Derek Parnell <derek nomail.afraid.org> writes:
On Sun, 02 Jul 2006 21:31:32 -0600, Hasan Aljudy wrote:

I finally got it to issue the message, and it has nothing to do with any of
the suggestions so far.

I create the file "c:\temp\main.d" that contained a single line 

   void main(){}

I then set my current directory to C:\

and this is the result I got ...
===================
C:\>type c:\temp\main.d
void main(){}
C:\>dmd main.d
main.d: module main cannot read file 'main.d'

C:\>

================

From this I gather than the first 'main.d' in the message is from the
command line, the module name is derived from the 'main.d' on the command
line and then the compiler said it could find the file.


When I run this test with Build I get ...

C:\>build main
Path and Version : y:\util\build.exe v3.02(2207)
  built on Sat Jun 24 00:44:57 2006
** File 'main.d' not found.
Error: build:Not all supplied files exist.

C:\>
-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocrity!"
3/07/2006 2:42:31 PM
Jul 02 2006
parent reply Bruno Medeiros <brunodomedeirosATgmail SPAM.com> writes:
Derek Parnell wrote:
 On Sun, 02 Jul 2006 21:31:32 -0600, Hasan Aljudy wrote:
 
 I finally got it to issue the message, and it has nothing to do with any of
 the suggestions so far.
 
 I create the file "c:\temp\main.d" that contained a single line 
 
    void main(){}
 
 I then set my current directory to C:\
 
 and this is the result I got ...
 ===================
 C:\>type c:\temp\main.d
 void main(){}
 C:\>dmd main.d
 main.d: module main cannot read file 'main.d'
 
 C:\>
 
 ================
Why create the c:\temp\main.d file? The error happens anywhere, with any module, just by typing "dmd foobar.d" where foobar.d doesn't exist. -- Bruno Medeiros - CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
Jul 03 2006
parent reply "Derek Parnell" <derek psych.ward> writes:
On Mon, 03 Jul 2006 17:58:59 +1000, Bruno Medeiros  =

<brunodomedeirosATgmail SPAM.com> wrote:

 Derek Parnell wrote:
 On Sun, 02 Jul 2006 21:31:32 -0600, Hasan Aljudy wrote:
  I finally got it to issue the message, and it has nothing to do with=
=
 any of
 the suggestions so far.
  I create the file "c:\temp\main.d" that contained a single line   =
    void main(){}
  I then set my current directory to C:\
  and this is the result I got ...
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 C:\>type c:\temp\main.d
 void main(){}
 C:\>dmd main.d
 main.d: module main cannot read file 'main.d'
  C:\>
  =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Why create the c:\temp\main.d file? The error happens anywhere, with a=
ny =
 module, just by typing "dmd foobar.d" where foobar.d doesn't exist.
Because I was doing many variations and I want to be complete, okay!? On= ce = one knows what triggers the problem, one doesn't have to do all the = dead-ends but I needed to show that the existance of the file SOMEWHERE = in = the system didn't influence the outcome. -- = Derek Parnell Melbourne, Australia
Jul 03 2006
parent Bruno Medeiros <brunodomedeirosATgmail SPAM.com> writes:
Derek Parnell wrote:
 On Mon, 03 Jul 2006 17:58:59 +1000, Bruno Medeiros 
 <brunodomedeirosATgmail SPAM.com> wrote:
 
 Derek Parnell wrote:
 On Sun, 02 Jul 2006 21:31:32 -0600, Hasan Aljudy wrote:
  I finally got it to issue the message, and it has nothing to do with 
 any of
 the suggestions so far.
  I create the file "c:\temp\main.d" that contained a single line     
 void main(){}
  I then set my current directory to C:\
  and this is the result I got ...
 ===================
 C:\>type c:\temp\main.d
 void main(){}
 C:\>dmd main.d
 main.d: module main cannot read file 'main.d'
  C:\>
  ================
Why create the c:\temp\main.d file? The error happens anywhere, with any module, just by typing "dmd foobar.d" where foobar.d doesn't exist.
Because I was doing many variations and I want to be complete, okay!? Once one knows what triggers the problem, one doesn't have to do all the dead-ends but I needed to show that the existance of the file SOMEWHERE in the system didn't influence the outcome. --Derek Parnell Melbourne, Australia
I'm sorry, I didn't mean to upset. It's just that it seemed clear that a file that is totally unknown to DMD (it's name or variations thereof don't appear on the command line, source code, config files, or anywhere else) couldn't possibly affect DMD's outcome. -- Bruno Medeiros - CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
Jul 04 2006