Help or Guide with Rust Book? (hello cargo/file locations?

⚓ rust    📅 2025-07-04    👤 surdeus    👁️ 2      

surdeus

Hi,

I am learning Rust and new to coding in general. I am wondering about hello cargo in rust book?

I am unable to recall Hello world by using command cargo build in my default terminal. I am only able to do it by cd the source path folder where my rust code is saved. Is this supposed to happen? The book reads like I should be able to recall the code from the terminal withoout selecting the source path fro rust files?

What am I doing wrong?

PS C:\Users\CC> cargo build
Finished dev profile [unoptimized + debuginfo] target(s) in 0.02s
PS C:\Users\CC> cargo run
Finished dev profile [unoptimized + debuginfo] target(s) in 0.01s
Running target\debug\C.exe
Hello, world!
PS C:\Users\CC> .\target\debug\hello_cargo.exe
.\target\debug\hello_cargo.exe : The term '.\target\debug\hello_cargo.exe' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At line:1 char:1

  • .\target\debug\hello_cargo.exe
  •   + CategoryInfo          : ObjectNotFound: (.\target\debug\hello_cargo.exe:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException

2 posts - 2 participants

Read full topic

🏷️ rust_feed