dmd error - unrecognized file extension

Evan Burkey evan at burkey.co
Mon Jan 29 18:29:52 UTC 2018


On Monday, 29 January 2018 at 18:02:47 UTC, rjframe wrote:
> On Mon, 29 Jan 2018 17:25:34 +0000, 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.


More information about the Digitalmars-d-learn mailing list