mystor / rust-cpp

Embed C++ directly inside your rust code!
Apache License 2.0
807 stars 44 forks source link

[Question] include local some.hpp #112

Closed minsoo5403 closed 5 months ago

minsoo5403 commented 6 months ago

I want to include a lib.hpp file located in the same directory as main.rs using rust-cpp. I've tried several methods, but they don't work properly. How should I go about this?

ogoffart commented 5 months ago

In your build.rs, use Config::include to add the src directory. (Which is relative to the CARGO_MANIFEST_DIR env variable.)

So something like

let mut config = cpp_build::Config::new();
...
config.include("src");
...
config.build();