DEV Community

Cover image for Rust chronicles #1 - the beginning
SiliconCatalyst
SiliconCatalyst

Posted on

Rust chronicles #1 - the beginning

Why Rust? Why now? simple, A Hackathon.
There is no deeper reasoning for this or a grandiose of a goal, a Rust-only Hackathon is happening close to where I live, I have never been to one of these events before, the event organizers clarified that there will be buckets based on experience, so beginners, intermediate, and professionals who actually got paid to write Rust code, and on a whim I signed up and got a ticket in the beginner's bucket, the issue is that, technically speaking, I am not even a beginner yet since I have never written a single line of Rust, following that stream of thoughts I arrived at the conclusion that the unavoidable embarrassment of being the most incompetent person there, is... well... unavoidable...

unless...

Hello World

Starting off we need a compiler, heading to rustup.rs we get our hands on the Rust Toolchain Installer, a .exe file (I atone for the gag that W*ndows inflicts on ultra-chad engineers. I shall repent by becoming mildly competent in Rust); Running the Rust toolchain installer with default options installs stable-x86_64-pc-windows-msvc, which includes rustc, Cargo, and Rust's standard libraries. This toolchain uses Microsoft's link.exe linker and the MSVC runtime libraries to link the compiled code into Windows executables.

To check if the installation happened correctly:

rustc --version
# rustc 1.91.1 (ed61e7d7e 2025-11-07)

cargo --version
# cargo 1.91.1 (ea2d97820 2025-10-10)
Enter fullscreen mode Exit fullscreen mode
  • rustc is the compiler that produces native machine code and .obj files that calls the Microsoft Linker link.exe, together with MSVC's linker, the final .exe or .dll is produced.
  • cargo is Rust’s official build system and package manager. It is the standard way to build Rust projects using cargo build, cargo run, cargo test and cargo bench.

After a successful installation we head to our editor to create our first Rust project, to do that we utilize cargo:

cargo new hello_rust
cd hello_rust
code . # If your code editor is VS Code
Enter fullscreen mode Exit fullscreen mode
  • src/main.rs - main entry point of the project:
fn main() {
    println!("Hello, world");
}
Enter fullscreen mode Exit fullscreen mode

Do not be fooled by the exclamation mark; it is but a fleeting glimmer of cheer in a profession otherwise defined by unending torment.

  • Cargo.toml - a manifest file that tells Rust’s package manager, Cargo, everything your project needs:
[package]
name = "hello_rust"
version = "0.1.0"
edition = "2024"

[dependencies]
Enter fullscreen mode Exit fullscreen mode

You can think of it as Rust’s equivalent of package.json in Node.js, go.mod in Go, or a .csproj file in C# (or pom.xml for Maven projects, or build.gradle / build.gradle.kts for Gradle projects; Java is very much alive and well, this was not added as an afterthought! trust me).

Running the Project

To run the project:

cargo run
Enter fullscreen mode Exit fullscreen mode

The result will be outputted in the terminal:

Compiling hello_rust v0.1.0
error: linker `link.exe` not found | = note: program not found note: the msvc targets depend on the msvc linker but `link.exe` was not found note: please ensure that Visual Studio 2017 or later, or Build Tools for Visual Studio were installed with the Visual C++ option. note: VS Code is a different product, and is not sufficient.

error: could not compile `hello_rust` (bin "hello_rust") due to 1 previous error
Enter fullscreen mode Exit fullscreen mode

I know what you're thinking: "A single line of Rust produced all of that? Truly a marvel of engineering".

Turns out I was missing the critical linker (from Microsoft Visual C++) that produces native Windows executables using the binaries from the rustc compiler. But I am a Software Engineer, and we are not mere mortals; we are problem-solving architects of the digital realm, tamers of logic, warriors against the tyranny of the compiler. It is our solemn calling, our sacred rite, our raison d’être to stare into the abyss of cryptic error messages, to wrest solutions from the clutches of dependency hell, and to emerge triumphant in the dead of night, clutching a freshly linked .exe like Excalibur itself. And so, with nothing but sheer willpower, caffeine, and perhaps a touch of desperation, I set out to conquer this issue.

First step: delete stable-x86_64-pc-windows-msvc:

rustup toolchain uninstall stable-msvc
Enter fullscreen mode Exit fullscreen mode

Second step: install the GNU toolchain and set it as the default toolchain

rustup toolchain install stable-gnu
rustup default stable-gnu
Enter fullscreen mode Exit fullscreen mode

And Viola!

cargo run

Compiling hello_rust v0.1.0
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.06s
     Running `target\debug\hello_rust.exe`

Hello, world
Enter fullscreen mode Exit fullscreen mode

MSVC Toolchain vs GNU Toolchain

There is bound to be tradeoffs between the two toolchains, I have since asked Claude to clarify what the tradeoffs are, and the result? Did not understand a thing he spewed out. in other words, I am not in the required skill bracket to even understand what the tradeoffs mean, so, for now, we are good to go with the lighter, and more portable GNU Toolchain that relies on the MinGW-w64 runtime.

End of log. Thanks for reading, see you in the next entry!

Top comments (0)