-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
When I follow your instructions and create this file:
// src/protocol.rs
include!(concat!(env!("OUT_DIR"), "/protocol.rs"));I get this error:
cargo build main
Compiling testclient v0.1.0 ...
error: environment variable `OUT_DIR` not defined at compile time
--> testclient/src/protocol.rs:1:18
|
1 | include!(concat!(env!("OUT_DIR"), "/protocol.rs"));
| ^^^^^^^^^^^^^^^
|
= help: Cargo sets build script variables at run time. Use `std::env::var("OUT_DIR")` instead
= note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
error: could not compile `testclient` (bin "testclient") due to 1 previous error
But when I do that, I obviously get the error:
1 | include!(concat!(std::env::var("OUT_DIR"), "/protocol.rs"));
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: only literals (like `"foo"`, `-42` and `3.14`) can be passed to `concat!()`
How do I use this project?
Metadata
Metadata
Assignees
Labels
No labels