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

header_contents requires providing a header file extension in name argument #2975

Open
wmmc88 opened this issue Nov 12, 2024 · 0 comments
Open

Comments

@wmmc88
Copy link

wmmc88 commented Nov 12, 2024

The below code fails because the name provided to the header_contents method doesn't have a valid c header file extension:

fn main() {
    bindgen::builder()
        .header_contents("input", "") // empty header
        .generate()
        .expect("Unable to generate bindings");
}

The docs don't mention this requirement and the error it creates doesn't actually say that this is the problem:

thread 'main' panicked at D:\.tools\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bindgen-0.69.4\ir\context.rs:556:15:
  libclang error; possible causes include:
  - Invalid flag syntax
  - Unrecognized flags
  - Invalid flag arguments
  - File I/O errors
  - Host vs. target architecture mismatch
  If you encounter an error missing from this list, please file an issue or a PR!
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I assumed that since the argument was name and since the docs didn't mention anything, that it would automatically append an appropriate file extension. I think the error should probably be updated and the docs too maybe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant