Why should file names intended for executables be valid identifiers?

Jon D via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 14 20:13:15 PST 2015


On Tuesday, 15 December 2015 at 03:31:18 UTC, Shriramana Sharma 
wrote:
>
> For instance, hyphens are often used as part of executable 
> names on Linux, but if I do this:
>
> $ dmd usage-printer.d
>
> I get the following error:
>
> usage-printer.d: Error: module usage-printer has non-identifier 
> characters in filename, use module declaration instead
>

Try adding the line:

     module usage_printer;

at the top of the file. This overrides the default module name 
(same as file name).

--Jon


More information about the Digitalmars-d-learn mailing list