之前发了一个问题,后来出现不少问题,猜测是不是环境变量设置的有问题?
我安装的时候没有自动安装环境变量,自己手动设置的:
新建变量RUST_HOME = rust的安装目录
path下增加%RUST_HOME%\bin
然后在cmd下执行rustc,出现了命令提示。
但是自己的rs源码使用int类型竟然也会报错:
fizzbuzz.rs:1:22: 1:25 error: use of undeclared type name `int`fizzbuzz.rs:1 fn div_by_three(num: int) -> bool{
^~~
error: aborting due to previous error
望大神赐教!
Rust
源码也是照抄的:
fn div_by_three(num: int) -> bool { if num % 3 == 0 { true } else { false } } #[test] fn test_div_by_three() { if div_by_three(1) { fail!("One is not three"); } } #[test] fn test_div_by_three_with_three() { if !div_by_three(3) { fail!("Three should be three"); } }引用来自“yangxingpping”的评论
提示很明显,int类型不存在,用i32,i64获取其他替代