Skip to content

Instantly share code, notes, and snippets.

@4sskick
Last active July 6, 2023 04:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 4sskick/a4bdb211d2cb6f14939783412990d767 to your computer and use it in GitHub Desktop.
Save 4sskick/a4bdb211d2cb6f14939783412990d767 to your computer and use it in GitHub Desktop.
RUST setup initial project from installation until run on first time
there's already a bunch of tutorial setup on internet up there. I will just covering some in my version from creating new project till run on as debug. I am using wsl2 on win11.
Following the steps on book Zero to production in RUST: An opinionated Introduction Backend. First thing first you need to install `rustup`, can be found on https://rustup.rs/
- open terminal and run wsl, run `sudo apt install build-essential # Install pre-reqs`
- done, then `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`
- it will downloading rust installer, proceed with type 1 to continue. Wait till finish
- verify the instalation by type `source $HOME/.cargo/env` and `rustc --version`. Output will there like rustc `1.70.0 (90c541806 2023-05-31)`
- if hapen not found for `rustc --version`, try to reload the wsl by shutdown command and re-open it up
- create folder for development like `mkdir rust_project` or whatever you like.
- type `cargo new rust_test` and open vscode by `code .`
- hit buton f5 and see recommendation following from vscode, like installing extension and generating `launch.json` file
- done with that,try to hit it up again. hover your arrow to tab terminal on built-in terminal vscode you will see output `Hello, World!`
Since Rust is a compiled language, you will notice that in the target > debug folder, there is an executable file for your application (file_type_project_name.exe)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment