Bindgen basic help


I’m trying to use bindgen to create bindings to C++ code (kea dhcp server).
I’m following guides but I’ve stumbled on first step… :slight_smile:
My Cargo.toml contains required declarations:

build = ""

bindgen = "0.26.1" in my crate root folder have content according to example from bindgen:

extern crate bindgen;

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

fn main() {
// code here

And I’m getting error when running cargo build:

error[E0463]: can't find crate for `bindgen`
1 | extern crate bindgen;
  | ^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

What I’m doing wrong ?


Put it in [build-dependencies] like



This helped. Thanks !

Why such information is not present in any bindgen doc/example ?


I just had a skim through their guide and found this.