ラベル Rust の投稿を表示しています。 すべての投稿を表示
ラベル Rust の投稿を表示しています。 すべての投稿を表示

2019年5月6日月曜日

2017年5月28日日曜日

Rust / FizzBuzz

fn main() {
    for n in 1..101 {
        match (n % 3, n % 5) {
            (0, 0) => println!("FizzBuzz"),
            (0, _) => println!("Fizz"),
            (_, 0) => println!("Buzz"),
            _ => println!("{}", n)
        }
    }
}

Rust / Hello

fn main() {
    let name = "Rust";
    println!("Hello, {}!", name);
}

VS2017 and Cargo

Visual Studio 2017(with C++) をインストールした環境で
"cargo build"すると、link.exeが見つからないというエラーが発生します。
note: the msvc targets depend on the msvc linker but `link.exe` was not found
note: please ensure that VS 2013 or VS 2015 was installed with the Visual C++ option
error: aborting due to previous error
Cargoは、まだVS2017のパスを認識できていないようです。
とりあえず、以下を実行することでビルドできるようになります。
\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat
(32bitの場合はvcvars32.bat)

詳細は以下を参照してください。
https://github.com/rust-lang/rust/issues/38584