LoginSignup
5
5

More than 5 years have passed since last update.

Rustプログラミングを始める

Last updated at Posted at 2014-10-19

Rustプログラミングの始め方。

公式ページはこちら

The Rust Guide

こちらの公式のガイドに沿って始めます。Max OS X 10.9.5で試します。

まずはRustをインストールします。

$ curl -s https://static.rust-lang.org/rustup.sh | sudo sh

ダウンロードに時間がかかりますが、待ちます。

インストールが終わったらバージョンを確認。

$ rustc --version
rustc 0.13.0-nightly (c46812f65 2014-10-19 00:47:18 +0000)

適当にディレクトリを作成して、Hello Worldしてみる。

mkdir rust_hello_workd
cd rust_hello_world

rust_hello_world.rsファイルを作成して、テキストエディタで以下のように書く。

rust_hello_world.rs
fn main() {
  println!("Hello, world!");
}

println!が付いているのはMacroらしいですが、今は気にしないでおく。

コンパイルする。

rustc rust_hello_world.rs

実行可能なrust_hello_worldファイルができあがるので、それを実行する。

$ ./rust_hello_world
Hello, world!

できました。

5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5