A slight problem with SDL2 and Rust
This is on Ubuntu 24.04 LTS. I’ve installed the dev versions of SDL2, including images and TTF. You can read how to install them in this tutorial.
Once that’s done you add them to the rust project with commands like this
cargo add sdl2
You can see these instruction in the relevant crates pages. For instance SDL2 crate, SDL2 Image and SDL2 TTF.
So far so good. The cargo add added the crates into cargo.toml as expected but when I compiled it. Not a compile error as such but a version of dll hell.
The text in that image says:
Updating crates.io index error: failed to select a version for `sdl2-sys`. ... required by package `sdl2_image v0.25.0` ... which satisfies dependency `sdl2_image = "^0.25.0"` of package `sdl1 v0.1.0 (/home/david/rust/sdl1)` versions that meet the requirements `^0.25.0` are: 0.25.0 the package `sdl2-sys` links to the native library `SDL2`, but it conflicts with a previous package which links to `SDL2` as well: package `sdl2-sys v0.37.0` ... which satisfies dependency `sdl2-sys = "^0.37.0"` of package `sdl1 v0.1.0 (/home/david/rust/sdl1)` Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the `links = "SDL2"` value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links. failed to select a version for `sdl2-sys` which could resolve this conflict
The problem appears to be a clash between sdl-sys and sdl2-ttf or sdl2-image. If anyone knows a fix…
Is that the use needs to specify file::module_name::…
I wrote a Poker Hand evaluator. It read in a file of a 1,000 randomly generated sets of seven cards like this AC 8H JC …and figured out what was the best hand. It’s in Rust and on 

Now the only pain with debugging is that the application must be running for Visual Studio to attach to it. I was debugging a utility that is run, does its business and closes. So to debug it, I added this as the first line in main() in program.cs
It’s been a few years since I compiled the code for the first eBook and I needed to create an SDL application on Windows. I copied a project, as it was the fastest way to setup the include and lib paths, and the lib files needed to compile.
On Linux (Ubuntu and Raspberry Pi OS) I use Visual Studio Code, but compiling or more specifically on the Terminal menu, Run Build Task defaults to Ctrl-Shift-B. Being lazy and a long time user of Visual Studio with it’s F6 key, I decided to change this.