On 2 September 2013 05:28, Brad Anderson <eco@gnuk.net> wrote:
On Sunday, 1 September 2013 at 07:42:47 UTC, Walter Bright wrote:
On 8/31/2013 7:05 PM, Manu wrote:
The only compiler you can realistically use productively in windows is
DMD-Win64, and that doesn't work out of the box.
We needed to mess with sc.ini for quite some time to get the stars aligned such
that it would actually compile and find the linker+libs.

Walter: DMD needs to internally detect installations of various versions of
VisualStudio, and either 'just work', or amend sc.ini on its own. Or the
installer needs to amend sc.ini. Either way, leaving it to a user to fiddle with
an ini file just isn't acceptable. We had to google solutions to this problem,
and even then, we had trouble with the paths we added to sc.ini; are spaces
acceptable? Do they have quites around them?...
I might also suggest that Microsoft supplied (ie, 'standard'), libraries should
be automatically detected and path entries added in there too:
  C:\Program Files (x86)\Microsoft SDKs\...
  C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\...
These are on basically every windows developers machine, and each of us had to
configure them ourselves.

The default sc.ini contains:
-----------------------------
[Version]
version=7.51 Build 020

[Environment]
LIB="%@P%\..\lib";\dm\lib
DFLAGS="-I%@P%\..\..\src\phobos" "-I%@P%\..\..\src\druntime\import"
LINKCMD=%@P%\link.exe
LINKCMD64=%VCINSTALLDIR%bin\amd64\link.exe
VCINSTALLDIR=%VCINSTALLDIR%
WindowsSdkDir=%WindowsSdkDir%
----------------------------------

When I installed VC 2010, it set the environment variables VCINSTALLDIR and WindowsSdkDir. Then, the default sc.ini should "just work".

What went wrong, specifically?

I can make the installer detect which versions of Visual Studio are installed and the path they are installed.  Would I rather I have the installer modify the installed sc.ini or set an environment variable?

Avoid environment variables in windows, if you ask me. They are a mess, and they are hard to manage through the stupid UI hidden in system settings->advanced->advanced->environment variables.
I think most windows users would consider sc.ini much simpler, but the most important thing is that they need to know it's there, and that it's critical that it's correct.

Another idea is to enhance DMD's error messages to warns about correct paths in sc.ini when it either fails to find link.exe, or encounters an OMF library (the two tell-tale errors that sc.ini is wrong).