On Tuesday, 14 April 2026 at 14:25:29 UTC, DLearner wrote:
This relates to:
```
DMD64 D Compiler v2.112.0
Copyright (C) 1999-2025 by The D Language Foundation, All
Rights Reserved written by Walter Bright
```
While trying to compile and run hello.c (ie trying out Import
C):
```
#include <stdio.h>
int main()
{
printf("Hello world.\n");
return 0;
}
```
I got
```
Error: cl.exe not found. Please ensure that Visual Studio Build
Tools are installed and properly configured.
```
despite repeatedly downloading everything I could find relating
to Visual Studio 2019.
FWIW, isn't 'cl.exe' MS's _own_ C compiler - I wanted to use
the C compiler within DMD.
Ideas?
This is a pretty common frustration for anyone starting with D on
Windows and it took me a while to sort out too.
The root issue is that DMD on Windows relies on Microsoft's
linker and build tools but doesn't always set up the PATH
correctly during installation. So even if everything is
downloaded, your terminal simply can't find cl.exe because it
doesn't know where to look.
Here's what actually works:
Step 1: Don't use regular Command Prompt or PowerShell. After
installing Visual Studio Build Tools, always open "x64 Native
Tools Command Prompt for VS" — you'll find it in your Start menu
after installation. This terminal has all the correct PATH
variables pre-loaded. This alone fixes the issue for most people.
Step 2: If you want to use regular terminal, you need to manually
add the MSVC compiler path to your system PATH. It usually lives
somewhere like:
C:\Program Files\Microsoft Visual
Studio\2022\BuildTools\VC\Tools\MSVC\[version]\bin\Hostx64\x64
Add this to your Environment Variables and cl.exe will be found
from any terminal.
Step 3: Verify your DMD installation. Run dmd --version first. If
that works but compilation still fails, the build tools aren't
linked properly. Reinstall DMD and during installation make sure
it detects your Visual Studio Build Tools automatically.
Step 4: Lightweight alternative. As DLearner mentioned, the full
Windows SDK is 300MB+ which feels heavy just to compile a hello
world. A cleaner option is using LDC (LLVM-based D compiler)
which handles Windows compilation more independently without
needing the full MSVC toolchain.
Honestly the whole thing reminded me of something I read while
researching a home project even something like finding the best
window installation Baltimore contractors taught me that proper
installation setup from the start saves enormous headache later.
Whether it's physical windows or Windows OS toolchains — if the
foundation isn't set up right, everything built on top of it
causes problems. Same principle applies here. Get the build
environment right first, then everything else just works.
Once your environment is properly configured, that simple Hello
World will compile in seconds. Don't let the setup friction
discourage you D is genuinely worth learning.