Search code examples
ddmd

D programming language: module stdio cannot read file std\stdio.d


I installed dmd (2.0 ?) using the windows installer and am trying to compile the following program:

module tcpechoserver;

import std.stdio;

const int MAXPENDING = 5;

int main(char[][] argv)
{
    if(argv.length != 2){
        writef("Usage: %s <port>", argv[0]);
    }

    return 0;
}   

But I get the following compiler error:

Error: module stdio cannot read file 'std\stdio.d'

Are there some paths I have to specify in order to get the standard library to work?


Solution

  • Look at the ~\windows\bin\sc.ini file in your dmd installation directory. It contains implicit command line arguments for dmd, which should look as this for dmd 2.048:

    LIB="%@P%\..\lib";\dm\lib

    and

    DFLAGS="-I%@P%\..\..\src\phobos" "-I%@P%\..\..\src\druntime\import"

    If they are ok, and it doesn't works, your installation is probably broken. I recommend you to simply download zipped version of compiler and unpack it over your installation.