Re: dmd error - unrecognized file extension

2018-01-29 Thread Ali Çehreli via Digitalmars-d-learn

On 01/29/2018 12:53 PM, Evan Burkey wrote:

On Monday, 29 January 2018 at 19:12:13 UTC, Steven Schveighoffer wrote:
version is a keyword, you can't use it here like this. Not sure if 
this is related to your issue directly, but definitely it will show up 
as an error when the compiler looks at it properly.


So I tried changing the name to "v.txt" and had the same results: 
PowerShell threw the same errors, but the D2 command prompt worked just 
fine.


It's the other "version". :) You can't use a keyword as a symbol:



immutable version = 1;// bad
immutable version_ = 1;   // good

Ali


Re: dmd error - unrecognized file extension

2018-01-29 Thread Evan Burkey via Digitalmars-d-learn
On Monday, 29 January 2018 at 19:12:13 UTC, Steven Schveighoffer 
wrote:
version is a keyword, you can't use it here like this. Not sure 
if this is related to your issue directly, but definitely it 
will show up as an error when the compiler looks at it properly.


So I tried changing the name to "v.txt" and had the same results: 
PowerShell threw the same errors, but the D2 command prompt 
worked just fine.


Re: dmd error - unrecognized file extension

2018-01-29 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Jan 29, 2018 at 02:12:13PM -0500, Steven Schveighoffer via 
Digitalmars-d-learn wrote:
> On 1/29/18 12:25 PM, Evan Burkey wrote:
> > Hi there, I have a problem that is eluding me, hoping someone can
> > help me see the light. I'm on Windows 10 using the latest version of
> > dmd. I have a directory with 2 files: "version.txt" and
> > "versioncheck.d".  version.txt contains a single line of text. I
> > have the line:
> > 
> >      immutable version = import("version.txt");
> 
> version is a keyword, you can't use it here like this. Not sure if
> this is related to your issue directly, but definitely it will show up
> as an error when the compiler looks at it properly.
[...]

Granted, though, the error message could have been a lot more helpful
than it is.  As it stands, it didn't even occur to me that `version`
being a keyword was the problem here until you pointed it out. That's a
sign that the compiler error message needs improvement. :-)


T

-- 
Life is too short to run proprietary software. -- Bdale Garbee


Re: dmd error - unrecognized file extension

2018-01-29 Thread Steven Schveighoffer via Digitalmars-d-learn

On 1/29/18 12:25 PM, Evan Burkey wrote:
Hi there, I have a problem that is eluding me, hoping someone can help 
me see the light. I'm on Windows 10 using the latest version of dmd. I 
have a directory with 2 files: "version.txt" and "versioncheck.d". 
version.txt contains a single line of text. I have the line:


     immutable version = import("version.txt");


version is a keyword, you can't use it here like this. Not sure if this 
is related to your issue directly, but definitely it will show up as an 
error when the compiler looks at it properly.


-Steve


Re: dmd error - unrecognized file extension

2018-01-29 Thread Evan Burkey via Digitalmars-d-learn

On Monday, 29 January 2018 at 18:02:47 UTC, rjframe wrote:

On Mon, 29 Jan 2018 17:25:34 +, Evan Burkey wrote:

Hi there, I have a problem that is eluding me, hoping someone 
can help me see the light. I'm on Windows 10 using the latest 
version of dmd. I have a directory with 2 files: "version.txt" 
and "versioncheck.d". version.txt contains a single line of 
text. I have the line:


 immutable version = import("version.txt");

and my dmd switches are:

 dmd -J. .\versioncheck.d

but dmd fails with "Error: unrecognized file extension". I've 
searched the internet but found very little about this 
problem. Hopefully I'm just missing something simple.


Thanks!


I have the same issue on Windows 10, but Linux works; have you 
checked the issue tracker yet?


It looks like just `dmd -J .\versioncheck.d` should work [I 
haven't tested this properly with an actual string mixin, but I 
don't get that error this way]. On Windows, dmd doesn't seem to 
like starting with the period.


So if it was in a different directory, instead of `dmd 
-J.\somedir` on Windows you'd need to just do `dmd -Jsomedir`


--Ryan


So I played around with it a bit more and discovered what the 
problem was. I normally am a Linux/BSD user but am running a 
Win10 machine to test multi-platform compatibility. What I 
discovered is that the Windows version has a special command 
prompt called D2. I was using PowerShell (as that is this 
system's default shell). Once I used the special D2 prompt the 
Unix-style switches worked fine.


Re: dmd error - unrecognized file extension

2018-01-29 Thread rjframe via Digitalmars-d-learn
On Mon, 29 Jan 2018 17:25:34 +, Evan Burkey wrote:

> Hi there, I have a problem that is eluding me, hoping someone can help
> me see the light. I'm on Windows 10 using the latest version of dmd. I
> have a directory with 2 files: "version.txt" and "versioncheck.d".
> version.txt contains a single line of text. I have the line:
> 
>  immutable version = import("version.txt");
> 
> and my dmd switches are:
> 
>  dmd -J. .\versioncheck.d
> 
> but dmd fails with "Error: unrecognized file extension". I've searched
> the internet but found very little about this problem. Hopefully I'm
> just missing something simple.
> 
> Thanks!

I have the same issue on Windows 10, but Linux works; have you checked the 
issue tracker yet?

It looks like just `dmd -J .\versioncheck.d` should work [I haven't tested 
this properly with an actual string mixin, but I don't get that error this 
way]. On Windows, dmd doesn't seem to like starting with the period.

So if it was in a different directory, instead of `dmd -J.\somedir` on 
Windows you'd need to just do `dmd -Jsomedir`

--Ryan


dmd error - unrecognized file extension

2018-01-29 Thread Evan Burkey via Digitalmars-d-learn
Hi there, I have a problem that is eluding me, hoping someone can 
help me see the light. I'm on Windows 10 using the latest version 
of dmd. I have a directory with 2 files: "version.txt" and 
"versioncheck.d". version.txt contains a single line of text. I 
have the line:


immutable version = import("version.txt");

and my dmd switches are:

dmd -J. .\versioncheck.d

but dmd fails with "Error: unrecognized file extension". I've 
searched the internet but found very little about this problem. 
Hopefully I'm just missing something simple.


Thanks!