You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to conditionally compile some code only when C++ is also compiled. This is for testing purpose, the tests need some data from the module ffi but not everything inside there, just a few struct.
#[cxx::bridge(namespace = "ao::rust")]mod ffi {pubstructUuid{// like this onepuba:u64,pubb:u64,}#[cfg(feature = "cpp")]extern"Rust"{// ... not needed, only if compiling c++}}
The problem is when I run the tests from the VS Code UI, It will give an error:
error[E0433]: failed to resolve: use of undeclared crate or module `cxx`
--> rust_pricing/src/lib.rs:77:3
|
77 | #[cxx::bridge(namespace = "ao::rust")]
| ^^^ use of undeclared crate or module `cxx`
In order t fix the error I put the bridge behind a features like this:
I would like to conditionally compile some code only when C++ is also compiled. This is for testing purpose, the tests need some data from the module ffi but not everything inside there, just a few struct.
The problem is when I run the tests from the VS Code UI, It will give an error:
In order t fix the error I put the bridge behind a features like this:
Now running tests from UI works but compiling rust from C++ does not work anymore, I get the error:
Apparently it expects exactly #[cxx::bridge(namespace = "ao::rust")], not cfg_attr
Is there a way to fix both?
The text was updated successfully, but these errors were encountered: