mystor / rust-cpp

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

[Question] include local some.hpp #112

Closed minsoo5403 closed 3 months ago

minsoo5403 commented 3 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 3 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();