digitalmars.D.learn - Import C under Windows 10
- DLearner (25/25) Apr 14 This relates to:
- Serg Gini (10/11) Apr 14 I don't... just wanted to say that I admire your passion of
- drug007 (6/40) Apr 14 I don't use Windows so I can't help you but despite the fact that
- Ferhat =?UTF-8?B?S3VydHVsbXXFnw==?= (4/30) Apr 15 Usually, Windows Command Prompt does not automatically recognize
- drug007 (3/7) Apr 15 Exactly! This link can be useful -
- DLearner (8/16) Apr 15 Thanks!
- drug007 (5/24) Apr 15 I don't think it's worth it. Too much efforts for nothing. dmd does not
- DLearner (10/19) Apr 16 If the maintainers of DMD don't wish to write a new preprocessor,
- Dennis (8/14) Apr 16 Unfortunately, Microsoft doesn't allow redistributing Visual
- DLearner (9/15) Apr 16 Installed using Windows installer from the Dlang website.
- Richard (Rikki) Andrew Cattermole (3/6) Apr 16 The issue isn't the preprocessor itself.
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?
Apr 14
On Tuesday, 14 April 2026 at 14:25:29 UTC, DLearner wrote:Ideas?I don't... just wanted to say that I admire your passion of trying to make ImportC working on "hello world" example.. First try in 2023: https://forum.dlang.org/post/tq76ke$2s28$1 digitalmars.com Then in 2024: https://forum.dlang.org/thread/azwhxaopahmquhbcczku forum.dlang.org Hopefully 2026 will become the year when ImportC will start working for you! Never give up! Never surrender!
Apr 14
On 4/14/26 17:25, 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?I don't use Windows so I can't help you but despite the fact that cl.exe is MS's own C compiler, dmd uses C compiler just to call the corresponding preprocessor. You can call it yourself and feed preprocessed files to dmd directly. You don't need any C compiler but you need a C preprocessor
Apr 14
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?Usually, Windows Command Prompt does not automatically recognize VS compilers (due to PATH issues). Just run everything in a x64 Native Tools Command Prompt for VS 2019 (or 32 bit).
Apr 15
On 4/15/26 10:20, Ferhat Kurtulmuş wrote:Usually, Windows Command Prompt does not automatically recognize VS compilers (due to PATH issues). Just run everything in a x64 Native Tools Command Prompt for VS 2019 (or 32 bit).Exactly! This link can be useful - https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=visualstudio
Apr 15
On Wednesday, 15 April 2026 at 10:49:14 UTC, drug007 wrote:On 4/15/26 10:20, Ferhat Kurtulmuş wrote:Thanks! For the record, by clearing out all earlier Visual Studio's and downloading Visual Studio 2026, and using 'Developer Powershell', I _finally_ made it work. However, would it not be better if the Windows DMD download was 'battery included', in the sense that the built-in C compiler did it's own preprocessing?Usually, Windows Command Prompt does not automatically recognize VS compilers (due to PATH issues). Just run everything in a x64 Native Tools Command Prompt for VS 2019 (or 32 bit).Exactly! This link can be useful - https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=visualstudio
Apr 15
On 4/15/26 21:54, DLearner wrote:On Wednesday, 15 April 2026 at 10:49:14 UTC, drug007 wrote:I don't think it's worth it. Too much efforts for nothing. dmd does not contain an internal C compiler, not at all, dmd translates C to D AST. And dmd does not contain a preprocessor in any form. So you need to write C preprocessor from scratch.On 4/15/26 10:20, Ferhat Kurtulmuş wrote:Thanks! For the record, by clearing out all earlier Visual Studio's and downloading Visual Studio 2026, and using 'Developer Powershell', I _finally_ made it work. However, would it not be better if the Windows DMD download was 'battery included', in the sense that the built-in C compiler did it's own preprocessing?Usually, Windows Command Prompt does not automatically recognize VS compilers (due to PATH issues). Just run everything in a x64 Native Tools Command Prompt for VS 2019 (or 32 bit).Exactly! This link can be useful - https://learn.microsoft.com/en-us/ visualstudio/ide/reference/command-prompt-powershell?view=visualstudio
Apr 15
On Wednesday, 15 April 2026 at 19:28:33 UTC, drug007 wrote:On 4/15/26 21:54, DLearner wrote:[...]If the maintainers of DMD don't wish to write a new preprocessor, could not one of the four or five preprocessors mentioned in 42.4.2 be somehow incorporated? It's just that cl.exe is less than 1Mb, yet the Visual Studio download to be able to use it is over 10Gb! And one seems to be forced to use the 'Developer Powershell', which is very sluggish compared to the normal terminal window (if you run DMD in the normal terminal window it can't find cl.exe).However, would it not be better if the Windows DMD download was 'battery included', in the sense that the built-in C compiler did it's own preprocessing?I don't think it's worth it. Too much efforts for nothing. dmd does not contain an internal C compiler, not at all, dmd translates C to D AST. And dmd does not contain a preprocessor in any form. So you need to write C preprocessor from scratch.
Apr 16
On Thursday, 16 April 2026 at 19:30:48 UTC, DLearner wrote:It's just that cl.exe is less than 1Mb, yet the Visual Studio download to be able to use it is over 10Gb!Unfortunately, Microsoft doesn't allow redistributing Visual Studio Build Tools.And one seems to be forced to use the 'Developer Powershell', which is very sluggish compared to the normal terminal window (if you run DMD in the normal terminal window it can't find cl.exe).DMD has a bunch of logic trying to find the Visual Studio installation path: https://github.com/dlang/dmd/blob/2a47bdaafa58a90af9d6ce621f561ef9eb0bc5fd/compiler/src/dmd/vsoptions.d#L213 Did you install it in a special way, or modify your registry / environment variables in any way?
Apr 16
On Thursday, 16 April 2026 at 19:46:48 UTC, Dennis wrote:On Thursday, 16 April 2026 at 19:30:48 UTC, DLearner wrote:[...]DMD has a bunch of logic trying to find the Visual Studio installation path: https://github.com/dlang/dmd/blob/2a47bdaafa58a90af9d6ce621f561ef9eb0bc5fd/compiler/src/dmd/vsoptions.d#L213 Did you install it in a special way, or modify your registry / environment variables in any way?Installed using Windows installer from the Dlang website. Registry not modified. Over time, some of the user (not system) paths were added to. The system paths are unmodified in any way (by me). FWIW: I noticed that there FOUR different locations for cl.exe - I thought this bizarre. Has anyone tested inputC using VS2026 - maybe MS changed paths?
Apr 16
On 17/04/2026 7:30 AM, DLearner wrote:If the maintainers of DMD don't wish to write a new preprocessor, could not one of the four or five preprocessors mentioned in 42.4.2 be somehow incorporated?The issue isn't the preprocessor itself. Its all the variables it sets, and the headers (can just throw mingw at it).
Apr 16









Serg Gini <kornburn yandex.ru> 