The error log will be very confusing if someone forgets to add the target before building for the first time.
root@TW59:~/wasm-learning/cli/hello# cargo build --target wasm32-wasi
Compiling hello v0.1.0 (/root/wasm-learning/cli/hello)
error[E0463]: can't find crate for `std`
|
= note: the `wasm32-wasi` target may not be installed
= help: consider downloading the target with `rustup target add wasm32-wasi`
error[E0463]: can't find crate for `std`
--> src/main.rs:1:5
|
1 | use std::env;
| ^^^ can't find crate
|
= note: the `wasm32-wasi` target may not be installed
= help: consider downloading the target with `rustup target add wasm32-wasi`
error: cannot find macro `println` in this scope
--> src/main.rs:6:5
|
6 | println!("{}", argument);
| ^^^^^^^
error: cannot find macro `println` in this scope
--> src/main.rs:4:3
|
4 | println!("hello");
| ^^^^^^^
error[E0433]: failed to resolve: use of undeclared crate or module `env`
--> src/main.rs:5:19
|
5 | for argument in env::args().skip(1) {
| ^^^ use of undeclared crate or module `env`
error: requires `sized` lang_item
Some errors have detailed explanations: E0433, E0463.
For more information about an error, try `rustc --explain E0433`.
error: could not compile `hello` due to 6 previous errors