Beginning rust programming
I am going to learn some rudimentary rust, so that I can hopefully write some simple programs.
I have installed the rust programming language compiler, according to the man page, to compile a program source to an executable on a GNU/Linux system I need.
rustc -o hello hello.rs
However, for really simple programs
rustc hello.rs
works fine.
Which is very similar to how you would compile in c.
So following the age-old tradition of creating a program to display hello world.
:~/Development/rust/helloworld$ ls
hello.rs
:~/Development/rust/helloworld$ rustc hello.rs
:~/Development/rust/helloworld$ ls
hello hello.rs
:~/Development/rust/helloworld$ ./hello
Hello, world!
:~/Development/rust/helloworld$
The manual then jumps in to using cargo, as this is better for managing larger projects, so this also needs to be installed
sudo apt install cargo
We can also check what versions we are running
rustc --version
rustc 1.75.0 (82e1608df 2023-12-21) (built from a source tarball)
cargo --version
cargo 1.75.0
$
References
Tags
Mastodon | ShellLabs | Join Mastodon |