Thread overview
Error: module `hello` is in file 'hello.d' which cannot be read
May 04, 2018
Alex
May 05, 2018
H. S. Teoh
May 05, 2018
Alex
May 05, 2018
Bauss
May 05, 2018
Alex
May 05, 2018
Alex
May 04, 2018
Hi

I just installed D on my windows 10 and want to try to compile a hello world. My source is a classical

import std.stdio;
void main() {
writeln("Hello, World!");
}

And I try to compile and get

C:\D>dmd hello.d
Error: module `hello` is in file 'hello.d' which cannot be read
import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos
import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import

What do I do wrong ?

D is installed at de root of C:, and the hello.d source code is at C:\D\dmd2\sources.

Thank you to you

Alex

May 04, 2018
On Fri, May 04, 2018 at 11:29:12PM +0000, Alex via Digitalmars-d-learn wrote:
> Hi
> 
> I just installed D on my windows 10 and want to try to compile a hello world. My source is a classical
> 
> import std.stdio;
> void main() {
> writeln("Hello, World!");
> }
> 
> And I try to compile and get
> 
> C:\D>dmd hello.d
> Error: module `hello` is in file 'hello.d' which cannot be read
> import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos
> import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import
> 
> What do I do wrong ?
> 
> D is installed at de root of C:, and the hello.d source code is at C:\D\dmd2\sources.
[...]

Where is your current directory?  If hello.d is in C:\D\dmd2\sources then you need to:

	C:
	cd \D\dmd2\sources
	dmd hello.d


T

-- 
Life begins when you can spend your spare time programming instead of watching television. -- Cal Keegan
May 05, 2018
Thank you for you for your quick answer.

I think I allready tryed this, before asking, but ...

C:\>cd D\dmd2\sources

C:\D\dmd2\sources>dmd hello.d
Error: module `hello` is in file 'hello.d' which cannot be read
import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos
import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import

C:\D\dmd2\sources>
May 05, 2018
On Friday, 4 May 2018 at 23:29:12 UTC, Alex wrote:
> Hi
>
> I just installed D on my windows 10 and want to try to compile a hello world. My source is a classical
>
> import std.stdio;
> void main() {
> writeln("Hello, World!");
> }
>
> And I try to compile and get
>
> C:\D>dmd hello.d
> Error: module `hello` is in file 'hello.d' which cannot be read
> import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos
> import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import
>
> What do I do wrong ?
>
> D is installed at de root of C:, and the hello.d source code is at C:\D\dmd2\sources.
>
> Thank you to you
>
> Alex
Try to add

module hello;

To the top of the file

May 05, 2018
On Saturday, 5 May 2018 at 12:26:20 UTC, Bauss wrote:
> Try to add
>
> module hello;
>
> To the top of the file

Still not working. I tryed both module hello; and module 'hello';



C:\D\dmd2\sources>dmd hello.d
Error: module `hello` is in file 'hello.d' which cannot be read
import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos
import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import

C:\D\dmd2\sources>
May 05, 2018
On Friday, 4 May 2018 at 23:29:12 UTC, Alex wrote:
> Hi
>
> I just installed D on my windows 10 and want to try to compile a hello world. My source is a classical
>
> import std.stdio;
> void main() {
> writeln("Hello, World!");
> }
>
> And I try to compile and get
>
> C:\D>dmd hello.d
> Error: module `hello` is in file 'hello.d' which cannot be read
> import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos
> import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import
>
> What do I do wrong ?
>
> D is installed at de root of C:, and the hello.d source code is at C:\D\dmd2\sources.
>
> Thank you to you
>
> Alex

You need to make sure hello.d is in the current dir

dir C:\D

does hello.d show up?

If not, then dmd can't find it and you have to tell it where it is or be in the right location.

type

dmd ThereIsNowFileHere12342123242231231412.d

and you will get the same error message.



May 05, 2018
On Saturday, 5 May 2018 at 17:13:08 UTC, IntegratedDimensions wrote:
>
> You need to make sure hello.d is in the current dir
>
> dir C:\D
>
> does hello.d show up?
>
> If not, then dmd can't find it and you have to tell it where it is or be in the right location.
>
> type
>
> dmd ThereIsNowFileHere12342123242231231412.d
>
> and you will get the same error message.

You have to be right. I removed the directory and started making de hello world file again and now it works.

Thank you to everyone?

Alex


May 10, 2018
On Saturday, 5 May 2018 at 10:39:17 UTC, Alex wrote:
> Thank you for you for your quick answer.
>
> I think I allready tryed this, before asking, but ...
>
> C:\>cd D\dmd2\sources
>
> C:\D\dmd2\sources>dmd hello.d
> Error: module `hello` is in file 'hello.d' which cannot be read
> import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos
> import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import
>
> C:\D\dmd2\sources>

http://suckhoeytecongdong.blogspot.com/2018/05/phong-kham-khoa-huu-tho-lua-ao-co-that.html