Installation, Hello World, Cargo

type
status
date
slug
summary
tags
category
icon
password
๐Ÿ˜€
In this part, I will show you how to install Rust, create dictionary and the Package manager Cargo. The version of Linux on my PC is Ubuntu 24.04. The version of Rust I use is ** in date 2025.06.

๐Ÿ“ Installing rustup on Linux

What is Linker?

A linker is an essential tool in the process of compiling a program. It helps one to join compiled output into one file.
A C compiler is useful because it contains a linker and many Rust packages depending on C code needs C compiler.
Ubuntu offer a default gcc compiler.
You can use
to check your gcc version:
<b/>
You can see more about linker in Linker - GeeksforGeeks

Installing rustup

You can use
to download rustup, and you will see something like below in your terminal:
<b/>
You can also use
to update Rust to the newest version:
<b/>

๐Ÿ“ Hello world

Creating a Project Directory

Go to your choosen path and type:
As a rustacean, you should use UNC(Universal Naming Convention) which use โ€˜_โ€™ to seperate words in name of directory and variable etc.

Writing and running a Rust Program

Make a new source file and call it main.rs(I choose vim in this blog, you can use and editor you like, even Graphical Editor):
Type below into main.rs(type โ€˜Iโ€™ for vim user):
fn is kind of like void main() in C++ or def main() in Python. We will see the difference in the future.
Println! is kind of like printf in C++ or printin Python. But in rust, a โ€˜!โ€™ is related to a concept Macro, or more precisely, it calls a macro. I will explain it in the distant future(maybe untill the last one-third part of the tutorial).
Save the file(for vim user):
Then go back to your terminal:
rustcย is the compiler for the Rust programming language, provided by the project itself.
./main is running โ€˜mainโ€™ command in Linux.

๐Ÿ“ Hello world

Creating a Project with Cargo

Building and Running a Cargo project

๐Ÿค— Summary

๐Ÿ“Ž Reference

  • My vedio on Youtube
ย 
๐Ÿ’ก
Any problems about Rust can be announced on my Youtube vedio comments.
Prev
test for this website
Next
Multiplication
Loading...
Article List
About this Notes
Basic Concepts
SDK install and env config
Journey of Rust
Algorithm
Stochastic Process and Diffusion Model
CUDA Basic Usage