mystor / rust-cpp

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

Undefined reference to `__cpp_closure_xxx` #86

Closed david-bouyssie closed 1 year ago

david-bouyssie commented 4 years ago

I have tried this crate using the following examples: https://docs.rs/cpp/0.5.5/cpp/ https://docs.rs/cpp/0.5.5/cpp/macro.cpp.html

However, my linker is failing and prints the following error: undefined reference to `__cpp_closure_17383989895670653357'

What am I doing wrong?

Thanks.

ogoffart commented 4 years ago

Looks like the link is failing, What platform are you running on. Are you using linker flag. the build.rs script should print a line to let cargo know it needs to link against the generated library.

david-bouyssie commented 4 years ago

I tried both on Windows x64 and Ubuntu x64. My rustc version is: 1.47.0 (18bf6b4f0 2020-10-07)

I also tried to git clone the rust-cpp and do a cargo test. I have a similar error.

Note that cxx (https://github.com/dtolnay/cxx) is working, as an alternative solution.

ogoffart commented 1 year ago

Looks like a similar problem to https://github.com/mystor/rust-cpp/issues/107 Closing this one as it has less details.