Compilation error

With this main.rs

fn main() {
println!("Hello, world!");
}

and this Cargo.toml

[package]
name = "tortugas_01"
version = "0.1.0"
authors = ["mario"]
edition = "2018"

See more keys and their definitions at The Manifest Format - The Cargo Book

[dependencies]
turtle = "1.0.6-rc.3"

with "cargo run" I get this response:

Help: how can I fix the compilation error. Use as Ubuntu operating system

Where did you get that version number for turtle? According to crates.io, the latest version is:

turtle = "1.0.0-rc.3"

Hi kaj, Thanks for your quick response.
I change in Crago.toml

[package]
name = "prueba"
version = "0.1.0"
authors = ["mario"]
edition = "2018"

See more keys and their definitions at The Manifest Format - The Cargo Book

[dependencies]
turtle = "1.0.0-rc.3"

compile with cargo run:

mario@Mandarina:~/rust_book/turtle/prueba$ cargo run
Updating crates.io index
error: failed to load source for a dependency on turtle

Caused by:
Unable to update registry https://github.com/rust-lang/crates.io-index

Caused by:
failed to fetch https://github.com/rust-lang/crates.io-index

Caused by:
object not found - no match for id (0386799da630e5caf5dd17f7d8982d9ac1761959); class=Odb (9); code=NotFound (-3)

Help: Something is corrupted in the dependencies. How to solve it ?

Strange. Adding turtle 1.0.0-rc.3 to a new project works for me. Maybe you need to run cargo clean or at least cargo update ?

PS. Forum Code Formatting and Syntax Highlighting has some tips about how to make code in posts more readable.

2 Likes

Somehow your copy of the Cargo registry got corrupted. Try:

rm -rf ~/.cargo/registry/

and then run cargo update.

1 Like

Thank you very much Kornel. Your help is excellent. I have successfully compiled. Greetings from Córdoba, Argentina.

1 Like