rust-cpp icon indicating copy to clipboard operation
rust-cpp copied to clipboard

`cpp!` fails with "not found in metadata"

Open Decapitated opened this issue 2 months ago • 1 comments

Hi, I ran into an issue where my project builds fine once, but then subsequent builds fail with errors like:

error: This cpp! macro is not found in the library's rust-cpp metadata.
note: Only cpp! macros found directly in the program source will be parsed -
note: They cannot be generated by macro expansion.](error: This cpp! macro is not found in the library's rust-cpp metadata. NOTE: Only cpp! macros found directly in the program source will be parsed - NOTE: They cannot be generated by macro expansion.

For some reason it wasn't getting rebuilt on changes.

To fix this, I added this to build.rs:

println!("cargo:rerun-if-changed=src/main.rs");

Note: I am using the latest nightly toolchain.

I just wanted to create this issue in case someone else runs into this problem.

Decapitated avatar Oct 09 '25 21:10 Decapitated