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
C header includes C++ Header #1089
Comments
Just googling around: https://github.com/microsoft/STL/blob/main/stl/inc/yvals.h#L334C1-L334C11
C doesn't have namespaces. So the headers are at least not transitively compatible with C. headers:
entry-points:
- ...
include-directives:
- 'C:\Users\mbwil\Desktop\guidolib\src\engine\include\**' |
Is there a way to filter like that? This is my configuration and it seems to include what it needs to the in the project without explicitly including those c++ headers. ffigen: |
I'm not familiar with the Windows headers here. I'd expect the Googling some more:
You might want to remove this to triage errors. |
I am attempting to use the Dart FFIGen to generate a binding for a library written in C++, with C-compatible headers. When I run the FFIGen, I get the following errors:
`PS C:\Users\mbwil\Documents\Programming\Flutter\guido_integration> dart run ffigen -v fine
[INFO] : Running in Directory: 'C:\Users\mbwil\Documents\Programming\Flutter\guido_integration'
[FINE] : Adding header/file: C:\Users\mbwil\Desktop\guidolib\src\engine\include\GUIDOEngine.h
[FINE] : CompilerOpts used: []
[INFO] : Input Headers: [C:\Users\mbwil\Desktop\guidolib\src\engine\include\GUIDOEngine.h]
[FINE] : Creating TranslationUnit for header: C:\Users\mbwil\Desktop\guidolib\src\engine\include\GUIDOEngine.h
[SEVERE] : Header C:\Users\mbwil\Desktop\guidolib\src\engine\include\GUIDOEngine.h: Total errors/warnings: 20.
[SEVERE] : C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\include\yvals_core.h:28:2: error: Error in C++ Standard Library usage [User-Defined Issue]
[SEVERE] : C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\include\yvals.h:334:1: error: unknown type name 'namespace' [Semantic Issue]
[SEVERE] : C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\include\yvals.h:334:1: error: expected ';' after top level declarator [Parse Issue]
[SEVERE] : C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\include\cstdlib:22:62: error: expected function body after function declarator [Parse Issue]
[SEVERE] : C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_wstdio.h:34:14: error: unknown type name 'FILE' [Semantic Issue]`
The second error stands out to me as the reason for the cascade of issues. Specifically, the build tools in the visual studio folder are C++ headers, and use the namespace keyword. This causes the tool to fail because C doesn't support this. So what is there to be done to avoid this collision?
Is there something in the internals that needs to be able to deal with C++ headers being depended on within the build tools, or am I missing a way around this problem?
Extra Information:
Thanks for any help!
The text was updated successfully, but these errors were encountered: