Bug 24111 – [ImportC] fatal error C1034: stdio.h: no include path set
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2023-08-26T09:55:58Z
Last change time
2024-03-03T04:35:11Z
Keywords
pull
Assigned to
No Owner
Creator
SHOO
Comments
Comment #0 by zan77137 — 2023-08-26T09:55:58Z
Even if VisualStudio or vs_buildtools is installed, the include path resolution may fail in ImportC, like this:
----------
test\use-c-sources\source\some_c_code.c(2): fatal error C1034: stdio.h: no include path set
----------
A workaround can be found by setting the INCLUDE environment variable.
But this behavior should be done automatically when VisualStudio is detected by dmd.
See also: https://github.com/dlang/dub/pull/2689/files#diff-7829468e86c1cc5d5133195b5cb48e1ff6c75e3e9203777f6b2e379d9e4882b3R104
Comment #1 by bugzilla — 2023-09-12T00:32:20Z
I'm a bit puzzled by this. When I open "Developer Command Prompt for VS 2022" from the Start menu, it sets the INCLUDE path appropriately. That entry in the Start menu was generated by the install of VS.
Comment #2 by alphaglosined — 2023-09-12T00:38:55Z
The premise of the problem is that you are required to both know of and to ensure the usage of the bat file(s) are applied to make ImportC work isn't acceptable.
Instead of dmd detecting it wasn't applied, and then applied automatically as part of running of the preprocessor.
It's a failure state built into ImportC on Windows. Alternatively, we could get MinGW working as per my email showing a way to make this work and not require this addition.
Comment #3 by bugzilla — 2023-11-06T18:59:01Z
I don't really know how dmd can account for failure to install VisualStudio. The error message is coming from VS, not dmd.
Comment #4 by alphaglosined — 2023-11-06T23:27:08Z
(In reply to Walter Bright from comment #3)
> I don't really know how dmd can account for failure to install VisualStudio.
> The error message is coming from VS, not dmd.
Visual Studio is installed.
The PATH variables are not setup, and therefore it appears to the toolchain as though it hasn't been.
"x64 Native Tools Command Prompt for VS 2022.bat", basically dmd needs to detect that bat file and automatically apply it before calling the cpp.
Comment #5 by dlang-bot — 2023-11-07T00:45:17Z
@kinke created dlang/dmd pull request #15780 "VSOptions: Prepare for setting the INCLUDE env var for importC" mentioning this issue:
- VSOptions: Prepare for setting the INCLUDE env var for importC
Upstreaming from LDC, to pave the way for fixing Issue 24111.
https://github.com/dlang/dmd/pull/15780
Comment #6 by dlang-bot — 2023-11-16T10:40:33Z
dlang/dmd pull request #15780 "VSOptions: Prepare for setting the INCLUDE env var for importC" was merged into master:
- e7bff1cf7a0dd456d333ff399f6095c5898630b4 by Martin Kinkelin:
VSOptions: Prepare for setting the INCLUDE env var for importC
Upstreaming from LDC, to pave the way for fixing Issue 24111.
https://github.com/dlang/dmd/pull/15780
Comment #7 by dlang-bot — 2024-02-25T12:44:49Z
@shoo created dlang/dmd pull request #16248 "Fix Bugzilla issue 24111 - [ImportC] fatal error C1034: stdio.h: no include path set" fixing this issue:
- Fix Bugzilla issue 24111 - [ImportC] fatal error C1034: stdio.h: no include path set
https://github.com/dlang/dmd/pull/16248
Comment #8 by dlang-bot — 2024-03-03T04:35:11Z
dlang/dmd pull request #16248 "Fix Bugzilla issue 24111 - [ImportC] fatal error C1034: stdio.h: no include path set" was merged into master:
- dd54f7809e2a3fc7e4e51a999c5b34fc4f2c52da by SHOO:
Fix Bugzilla issue 24111 - [ImportC] fatal error C1034: stdio.h: no include path set
https://github.com/dlang/dmd/pull/16248