I have the following directory structure
/main.rs
/lib.rs
/tutorial/mod.rs
/tutorial/foo.rs
In foo.rs
I need to use a macro from the glium library, implement_vertex!
. If I put #[macro_use] extern crate glium;
at the head of foo.rs
, I get a error: an `extern crate` loading macros must be at the crate root
. I also get a error: macro undefined: 'implement_vertex!'
There is also a lib.rs
that is the crate root of the tutorial modules. I needed to put #[macro_use]
there. Does this create 2 crate roots if I have both main.rs
and lib.rs
?
What is the correct way to import macros in a submodule?
cargo build
)? Have you modified yourCargo.toml
? In what file is the linemod tutorial;
? In what file is the linemod foo;
? Without this information, we can only guess how your module tree looks like, as @Glassco already said. – Roughcast