Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zig c++ doesn't set the system include directories when input file is .h #5313

Open
SpexGuy opened this issue May 10, 2020 · 2 comments
Open
Labels
bug Observed behavior contradicts documented or intended behavior zig cc Zig as a drop-in C compiler feature
Milestone

Comments

@SpexGuy
Copy link
Contributor

SpexGuy commented May 10, 2020

When compiling with zig c++, if the input file is .h instead of .cpp the system include directories are not set up properly. With a .cpp file:

-isystem C:\dev\zig\build-release\lib\zig\libcxx\include
-isystem C:\dev\zig\build-release\lib\zig\include
-isystem C:\dev\zig\build-release\lib\zig\libc\include\x86_64-windows-gnu
-isystem C:\dev\zig\build-release\lib\zig\libc\include\generic-mingw
-isystem C:\dev\zig\build-release\lib\zig\libc\include\x86_64-windows-any
-isystem C:\dev\zig\build-release\lib\zig\libc\include\any-windows-any

With a .h file:

-isystem C:\dev\zig\build-release\lib\zig\libcxx\include

If you're wondering "why would you ever want to do that?", the answer is that I have a tool that parses a preprocessed header. So it uses zig c++ -DSTUFF=FOO -E header.h and then goes through the output and parses it.

This works fine with clang (as long as -nostdinc is not specified).

@SpexGuy
Copy link
Contributor Author

SpexGuy commented May 10, 2020

This is specifically on windows, when compiling with --target=native-native-gnu. The default target on windows is currently broken due to #5312

@Vexu Vexu added the zig cc Zig as a drop-in C compiler feature label May 11, 2020
@Vexu Vexu added this to the 0.7.0 milestone May 11, 2020
@wozeparrot
Copy link
Contributor

This also happens on linux.

@andrewrk andrewrk added the bug Observed behavior contradicts documented or intended behavior label Oct 17, 2020
@andrewrk andrewrk modified the milestones: 0.7.0, 0.8.0 Oct 17, 2020
@andrewrk andrewrk modified the milestones: 0.8.0, 0.8.1 Jun 4, 2021
@andrewrk andrewrk modified the milestones: 0.8.1, 0.9.1 Sep 1, 2021
@andrewrk andrewrk modified the milestones: 0.9.1, 0.9.0 Nov 20, 2021
@andrewrk andrewrk modified the milestones: 0.9.1, 0.10.0 Feb 3, 2022
@andrewrk andrewrk modified the milestones: 0.10.0, 0.11.0 Apr 17, 2022
@andrewrk andrewrk modified the milestones: 0.11.0, 0.12.0 Jun 19, 2023
@andrewrk andrewrk modified the milestones: 0.14.0, 0.16.0 Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior zig cc Zig as a drop-in C compiler feature
Projects
None yet
Development

No branches or pull requests

4 participants