1

I am trying to learn how to use bindgen. I am following the documentation(https://rust-lang.github.io/rust-bindgen/tutorial-3.html) and I have the following code to link to a C library:

extern crate bindgen;

use std::env;
use std::path::PathBuf;

fn main() {
  println!("cargo:rustc-link-lib=vulkan-1");
  println!("cargo:rerun-if-changed=vulkan/vulkan.h");

  let bindings = bindgen::Builder::default().header("vulkan/vulkan.h").parse_callbacks(Box::new(bindgen::CargoCallbacks)).generate().expect("Unable to generate bindings");

  let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
  bindings.write_to_file(out_path.join("bindings.rs")).expect("Couldn't write bindings!");
}

But when I run cargo build, I get note: LINK : fatal error LNK1181: cannot open input file 'vulkan-1.lib'. What did I do wrong?

nico.user
  • 483
  • 2
  • 5
  • 15

0 Answers0