0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rust言語(install~hello_world!)

Posted at

はじめに

はじめてのRustプログラムでの開発環境構築(Windows)についての記事です。
Rustではない言語、コマンドライン(コマンドプロンプト)の操作がある程度なれている人に対してです。

Rustのインストール

Rustのページそのままの操作です。簡単です。
https://www.rust-lang.org/learn/get-started
上記にアクセスし、__RUSTUP-INIT.EXE__のダウンロードを行ってください。

その後、そのファイルを実行し、

Rust is installed now. Great!

と表示されれば、インストールの完了です。

「Hello World!」の表示(vscode)

Visual Studio Code上での操作になりますので、vecodeのインストールがまだな人は別の投稿、記事を参照してください。

コマンドライン(cmd)を開きます。
rustup-init.exeの存在する同フォルダで、

mkdir ~/sample
cd sample
mkdir hello_world
cd hello_world

上の2行分に関しては、先にフォルダを自分で作成してもらっても大丈夫です。

次にvscodeを開いて、
__Extensionsマーク__または__Ctrl+Shift+X__を押して、EXTENSIONS:MARKETPLACEを開きます。
そこで、"rust(rls)"を検索
上記のものをインストールし以下のことを行ってください。

①__Ctrl+N__
を押してソースコードの新規を作成。
②__Ctrl+S__
で先に保存しましょう。

保存名は、__sample.rs__としておきます。
③また、保存した後に、中身を入力します。プログラムの基本的な環境構築ができてるか確認するための操作として、「Hello Wolrd!」の表示をします。

fn main(){
    print("hello world!");
}

または

fn main(){
    println!("hello world!");
}

と書いてください。文法的には今回はどちらでも実行されると思います。
④プログラムを打ったら、右上の__Run Codeボタン__(三角形のマーク)を押すか、__Ctrl+Alt+N__を同時に押すと、実行されます。
その他にも、task runなどもありますが一番簡単でしょう。

今回は、プログラム初心者でなければすぐできるであろうものだと思いますが一応まとめておきます。

0
3
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
0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?