Rust problem on unix

I am new to rust. I have used python.
I have installed rust on a Mac. I have checked to make sure that rust is installed properly. I am following the hello wold example but it appears to fail to print.
I believe I have failed to do something.

How are you running the program? Are you using cargo run? What is the code you are trying to run?

1 Like

Do you get any kind of an error message?

Thank you for your question. I do not get an error message. When I hit return nothing happens.

I purchased a book called Beginning Rust by Carlo Milanesi.
The book states on page 2 to type this into the terminal
rustic main.rs. I follow the book to the exact method it describes and
Nothing happens.
What am I doing wrong

Nothing I did reply to your message

rustc main.rs just compiles your program. You need to run the executable it produces to get an output. (The executable will be called main.exe)

1 Like

On MacOS, shouldn't it be just main?

Ah, possibly. I missed that in their description

Thank you I will give it a try

Thanks for the info but nothing works. I have enclosed page 2 of the book Beginning

RUST

Hi, I have enclosed page 2 of Beginning Rust. I am following this book

Ok, you did:

rustc main.rs

and then you did:

./main

Can you include a screenshot or copy/paste of your terminal output?

step 1 : check g++ (c++ compiler) or clang installed in you computer ,if not install it first
step 2 : Install rust from official site
step 3 : run Hello world in rust : rustc <file name>.rs && ./<file name>
step 4 : if you face any problem after restart your system like : rustc (command not found) ..
then add export PATH="$HOME/.cargo/bin:$PATH" to .bashrc in home folder

Thanks for the info but nothing works. I have enclosed page 2 of the book Beginning

RUST

I reread the chapter over again and found the answer.i was not using ./main to print hello world.
I would like to thank all those who stuck by me.

can you share the screen shot of the error message

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.