Jump to page: 1 2
Thread overview
October 28

Just trying ImportC under Windows 10:

#include <stdio.h>

int main()
{
   printf("Hello world.\n");
   return 0;
}

Produces

dmd hello.c
failed launching cl.exe /P /Zc:preprocessor /PD /nologo hello.c /FIC:\D\dmd2\windows\bin64\..\..\src\druntime\import\importc.h /Fihello.i
Error: C preprocess command cl.exe failed for file hello.c, exit status 1

Any ideas?

Best regards

October 29
https://github.com/dlang/dmd/blob/dbba866c71db5e1222a1b631b3e910f1a0811732/compiler/src/dmd/link.d#L1332

cl.exe comes from Visual Studio (MSVC).

If you haven't got it installed, that'll be why.

Otherwise its related to dmd not being able to find it.
October 29

On Tuesday, 29 October 2024 at 00:10:17 UTC, Richard (Rikki) Andrew Cattermole wrote:

>

https://github.com/dlang/dmd/blob/dbba866c71db5e1222a1b631b3e910f1a0811732/compiler/src/dmd/link.d#L1332

cl.exe comes from Visual Studio (MSVC).

If you haven't got it installed, that'll be why.

Otherwise its related to dmd not being able to find it.

Thank you.
I installed Visual Studio 2022, proved the existence of cl.exe, and added the location to the search path.

However, there is still a problem:

dmd hello.c
C:\D\dmd2\windows\bin64\..\..\src\druntime\import\importc.h(134): fatal error C1034: sal.h: no include path set
Error: C preprocess command cl.exe failed for file hello.c, exit status 2

which looks like dmd found cl.exe, but did not supply it with all the data it required.

October 29

On Tuesday, 29 October 2024 at 12:23:06 UTC, DLearner wrote:

>

However, there is still a problem:

dmd hello.c
C:\D\dmd2\windows\bin64\..\..\src\druntime\import\importc.h(134): fatal error C1034: sal.h: no include path set
Error: C preprocess command cl.exe failed for file hello.c, exit status 2

which looks like dmd found cl.exe, but did not supply it with all the data it required.

I don't do much on Windows, so I was having trouble with getting the VS stuff installed correctly. I borrowed this command from the Swift installation guide and everything worked:

winget install --id Microsoft.VisualStudio.2022.Community --exact --force --custom "--add Microsoft.VisualStudio.Component.Windows11SDK.22000 --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64"
October 29

On Tuesday, 29 October 2024 at 12:42:49 UTC, Lance Bachmeier wrote:

>

On Tuesday, 29 October 2024 at 12:23:06 UTC, DLearner wrote:

>

However, there is still a problem:

dmd hello.c
C:\D\dmd2\windows\bin64\..\..\src\druntime\import\importc.h(134): fatal error C1034: sal.h: no include path set
Error: C preprocess command cl.exe failed for file hello.c, exit status 2

which looks like dmd found cl.exe, but did not supply it with all the data it required.

I don't do much on Windows, so I was having trouble with getting the VS stuff installed correctly. I borrowed this command from the Swift installation guide and everything worked:

winget install --id Microsoft.VisualStudio.2022.Community --exact --force --custom "--add Microsoft.VisualStudio.Component.Windows11SDK.22000 --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64"

Thanks for the idea.
The winget installation completed without issues.
Unfortunately, 'dmd hello.c' produced the same error message as before.

October 29

On Tuesday, 29 October 2024 at 15:14:24 UTC, DLearner wrote:

>

On Tuesday, 29 October 2024 at 12:42:49 UTC, Lance Bachmeier wrote:

>

On Tuesday, 29 October 2024 at 12:23:06 UTC, DLearner wrote:

>

However, there is still a problem:

dmd hello.c
C:\D\dmd2\windows\bin64\..\..\src\druntime\import\importc.h(134): fatal error C1034: sal.h: no include path set
Error: C preprocess command cl.exe failed for file hello.c, exit status 2

which looks like dmd found cl.exe, but did not supply it with all the data it required.

I don't do much on Windows, so I was having trouble with getting the VS stuff installed correctly. I borrowed this command from the Swift installation guide and everything worked:

winget install --id Microsoft.VisualStudio.2022.Community --exact --force --custom "--add Microsoft.VisualStudio.Component.Windows11SDK.22000 --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64"

Thanks for the idea.
The winget installation completed without issues.
Unfortunately, 'dmd hello.c' produced the same error message as before.

you need to invoke that command inside this windoze stupid thing:

https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=vs-2022

October 29

On Tuesday, 29 October 2024 at 15:49:13 UTC, ryuukk_ wrote:

>

On Tuesday, 29 October 2024 at 15:14:24 UTC, DLearner wrote:

>

On Tuesday, 29 October 2024 at 12:42:49 UTC, Lance Bachmeier wrote:

>

On Tuesday, 29 October 2024 at 12:23:06 UTC, DLearner wrote:

>

However, there is still a problem:

dmd hello.c
C:\D\dmd2\windows\bin64\..\..\src\druntime\import\importc.h(134): fatal error C1034: sal.h: no include path set
Error: C preprocess command cl.exe failed for file hello.c, exit status 2

which looks like dmd found cl.exe, but did not supply it with all the data it required.

I don't do much on Windows, so I was having trouble with getting the VS stuff installed correctly. I borrowed this command from the Swift installation guide and everything worked:

winget install --id Microsoft.VisualStudio.2022.Community --exact --force --custom "--add Microsoft.VisualStudio.Component.Windows11SDK.22000 --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64"

Thanks for the idea.
The winget installation completed without issues.
Unfortunately, 'dmd hello.c' produced the same error message as before.

you need to invoke that command inside this windoze stupid thing:

https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=vs-2022

Similar message from Powershell:

PS C:\Users\SoftDev\Documents\BDM\projects\it\c> dmd hello.c
C:\D\dmd2\windows\bin64\..\..\src\druntime\import\importc.h(134): fatal error C1034: sal.h: no include path set
Error: C preprocess command C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\bin\HostX64\x64\cl.exe failed for file hello.c, exit status 2

October 30
On 30/10/2024 1:23 AM, DLearner wrote:
> On Tuesday, 29 October 2024 at 00:10:17 UTC, Richard (Rikki) Andrew Cattermole wrote:
>> https://github.com/dlang/dmd/blob/ dbba866c71db5e1222a1b631b3e910f1a0811732/compiler/src/dmd/link.d#L1332
>>
>> cl.exe comes from Visual Studio (MSVC).
>>
>> If you haven't got it installed, that'll be why.
>>
>> Otherwise its related to dmd not being able to find it.
> 
> Thank you.
> I installed Visual Studio 2022, proved the existence of cl.exe, and added the location to the search path.
> 
> However, there is still a problem:
> ```
> dmd hello.c
> C:\D\dmd2\windows\bin64\..\..\src\druntime\import\importc.h(134): fatal error C1034: sal.h: no include path set
> Error: C preprocess command cl.exe failed for file hello.c, exit status 2
> 
> ```
> 
> which looks like dmd found cl.exe, but did not supply it with all the data it required.

Don't add cl.exe directly to your PATH variable, there are other stuff in the environment variables that has to be setup for it to operate (sigh).

If dmd can't find it, via the VS lookup and get it working, you'll need to as ryuukk said, run dmd inside of cmd prompt that has the Visual Studio tools batch script run in it. Found in your start menu under Visual Studio (version).

October 29

On Tuesday, 29 October 2024 at 16:14:22 UTC, DLearner wrote:

>

On Tuesday, 29 October 2024 at 15:49:13 UTC, ryuukk_ wrote:

>

On Tuesday, 29 October 2024 at 15:14:24 UTC, DLearner wrote:

>

On Tuesday, 29 October 2024 at 12:42:49 UTC, Lance Bachmeier wrote:

>

On Tuesday, 29 October 2024 at 12:23:06 UTC, DLearner wrote:

>

However, there is still a problem:

dmd hello.c
C:\D\dmd2\windows\bin64\..\..\src\druntime\import\importc.h(134): fatal error C1034: sal.h: no include path set
Error: C preprocess command cl.exe failed for file hello.c, exit status 2

which looks like dmd found cl.exe, but did not supply it with all the data it required.

I don't do much on Windows, so I was having trouble with getting the VS stuff installed correctly. I borrowed this command from the Swift installation guide and everything worked:

winget install --id Microsoft.VisualStudio.2022.Community --exact --force --custom "--add Microsoft.VisualStudio.Component.Windows11SDK.22000 --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64"

Thanks for the idea.
The winget installation completed without issues.
Unfortunately, 'dmd hello.c' produced the same error message as before.

you need to invoke that command inside this windoze stupid thing:

https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=vs-2022

Similar message from Powershell:

PS C:\Users\SoftDev\Documents\BDM\projects\it\c> dmd hello.c
C:\D\dmd2\windows\bin64\..\..\src\druntime\import\importc.h(134): fatal error C1034: sal.h: no include path set
Error: C preprocess command C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\bin\HostX64\x64\cl.exe failed for file hello.c, exit status 2

It might be a bug so create an issue. It's hard to see how it's not.

October 30
https://issues.dlang.org/show_bug.cgi?id=24308
« First   ‹ Prev
1 2