-
Notifications
You must be signed in to change notification settings - Fork 758
Update clang flag in cpp.md #1852
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
Conversation
Removed excess space arg that will cause a panic when used with `.clang_arg()`. Fixed style.
I imagine this is the kind of error you are seeing if you do
I think However, if we should change the docs in the short term, then we should update |
Some developer on the Rust Discord suggested that the space after |
I can confirm this works. Aka, sending a C++ header ending with
Adding |
I added another PR for |
I do not think it is necessary or helpful to have a separate PR per Markdown file. If we update the documentation, it would be better for the related updates to occur in one PR. However, I think we still need to agree on a few things. The space between The problem is shown when you look carefully at the backtrace. There is a space before
I believe compiler documentation online is going to show the space more often than not, and that changing We can already see multiple examples in rust-bindgen/tests/stylo_sanity.rs Lines 532 to 533 in 03dbd1a
rust-bindgen/bindgen-integration/build.rs Line 155 in 03dbd1a
and there are also many files like this :
Here is an use std::path::PathBuf;
fn main() {
let bindings = bindgen::Builder::default()
.header("wrapper.hpp")
//.clang_arg("-x c++") // does not work
.clang_arg("'-x c++'") // works, probably should not be used
.clang_args(&["-x", "c++"]) // works
.clang_arg("-x").clang_arg("c++") // works (see tests/stylo_sanity.rs)
.generate()
.expect("Couldn't make bindings!");
let out_path = PathBuf::from(std::env::var("OUT_DIR").unwrap());
bindings.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings!");
} My points are that
Thank you for finding this, @virtualritz. I have created #1855 to track this issue. We can discuss the right solution further there. |
Removed excess space arg that will cause a panic when used with
.clang_arg()
.Fixed style.