how to install?

glen worstell glen at worstell.com
Thu Feb 21 17:18:09 PST 2008


Thanks, Kris. I did figure this out and it worked fine.

I expect other new users may be not understanding the library situation at first, as I did not. If any new users get to here, this may help:

The following is not meant to flame anyone, it is meant to help people new to d to get started with it on the Windows XP platform. I am not an expert but this information has been tested and I am pretty sure it is correct.

There is not a single implementation of d for windows, because unlike for other languages the library is not separate but is part of the compiler.

You must choose between the phobos compiler/library and the tango compiler/library. This is a very unfortunate and unnecessary situation, but it is what it is.

The difference in the compilers is that the tango compiler/library has an older version of the compiler (and probably always will), and the latest version of the phobos d compiler is quite a bit different. Therefore you must base your choice on not only which library you like better, but also which implementation of the compiler you like better.

Currently I consider the phobos compiler to be better than the tango one. I don't have a firm opinion about the libraries, but I think I like tango better. I have to decide between having a compiler that I prefer or having a library that I prefer. You can't have both at this time. :(

I purchased the book "Learn to Tango with D" and found it helpful. However, it does not describe either version of D except superficially, and it does not completely describe the tango library, and it does not have an index. :(
I do recommend the book to people getting started, no matter which version of the compiler/library you think you might end up with, because it is helpful to a new d programmer.

I decided to work with both versions for a while before deciding on one. Because the compiler is different (for example, the phobos compiler/library I use is version 2.011, and the tango one is 1.026, the difference is significant.

 I created two directories -  c:\tango, and c:\phobos.

To install the tango compiler/library, I downloaded and installed according to the directions Kris posted, repeated below, except I got version 1.026 and unzipped to c:\tango). There will be a bunch of directories, including bin.

Set your path to include c:\tango\bin, and then you can create a source file anywhere on your system (I'd  not put my source code in c:\tango as I like to keep things better organized than that). The source file should be named hello.d (or whatever file name you choose, with a .d extension).

fire up cmd and cd to your source directory and do "jake hello.d" and it should all work. If there are no errors you can run the resulting .exe file.

To install the phobos compiler/library, go to the Digital Mars site and see if you can find downloads for dmc and dmd. You will probably want the latest version of dmd, which today is 2.011. It is not in the obvious places so try looking for news or announcements. I forgot exactly where I found it.

First, unzip dmc (I was unable to find a version number for this) into your c:\phobos. Then unzip dmd into the same directory. You will get errors about duplicate file names; you should choose to overwrite all files.

Now fix your path, after getting rid of the path for tango. You need two additions to the path: c:\phobos\dm\bin and c:\phobos\dmc\bin (in that order).

Now you can cd to wherever your source code is, and do (for example) dmd hello.d

You won't get to use jake, which is too bad because that tool is very nice.  Search the tango web site to learn more about jake and other tools.

If it compiles and links without errors you'll get a hello.exe (or whatever source file name you used) which can then be run.

I've not yet decided which I want, so I installed both. It is necessary to change the path when switching from one to the other.

Changing the path got to be a pain, so I removed the d stuff from the path and now I rely on my text editor (TextPad) to set the path for me according to which system I am using. You could easily use batch files for the same thing. In your directory for phobos source files you could have a batch file called something like "setPhobosPath" that would append the right thing to your path, like this:
set path=%path%;c:\phobos\dm\bin;c:\phobos\dmd\bin

In the directory for your tango source files you would create a similar batch file. BTW, my source directories are not even on the c drive; they can be anywhere.

Note to implementers: the idea of requiring a compiler to use a particular library is so annoying that I may just use c# for my 1500 line project. The argument that d is faster than c# is meaningless for most application programs. I'd prefer to use d because I like the language better and because it generates .exe files, but I consider c# to be very well done and perfectly suitable for many windows applications. My main complaint with c# is that they got carried away with objects. In d, it is easy to use objects when they are useful and easy to ignore object-oriented programming when it is not particularly useful.

So, a plea from a potential user: fix the compiler so it can be used with either library. It seems that this has almost been done already, but almost means not quite. If you do this, then anyone can get the latest compiler and use it with either or both libraries.

Hope this helps ...

Glen.

Kris Wrote:

> Hi Glen,
> 
> Just tried this myself and had no difficulties, so I'll list the steps I 
> went through:
> 
> 1) download from the web-site. I used this link: 
> http://dsource.org/projects/tango/wiki/DmdDownloads  and clicked on where it 
> says "repository snapshot as a zip (including DMD 1.025)"
> 
> 2) made a fresh folder called '\d' and expanded the zip files over there 
> (create a folder wherever you need it). This added a series of folders to 
> '\d', one if which is '\d\bin'
> 
> 3) opened a console window in \d
> 
> 4) I set my exe path to this \d\bin directory, using "set path=\d\bin"
> 
> 5) did a "cd \d\example\console"
> 
> 6) did a "jake hello.d"
> 
> And all was fine.
> 
> I think you perhaps got into a situation where the sc.ini being picked up 
> did not match the installation? This might happen if you have multiple 
> compilers in your 'path' settings, for example.
> 
> Hope this helps ...
> 
>


More information about the Digitalmars-d-learn mailing list