Why am I not able to run and compile my program after creating a directory for the project?

I have checked all my installations and there is no problem but am still not able to run and compile the program

Are you moving into the newly created directory?
What command are you using?

1 Like

Am new to the language therefore I have followed all the steps on creating a new directory
I did create the main.rs and added to it the code given and saved all
But when I gave the main.rs command it says aborted due to previous error
Please help

If it says aborted due to previous error, there was an error printed before that. What was it?

Did you create main.rs yourself, or did you run cargo new? Running cargo new is better, because it also creates Cargo.toml configuration file that you're going to need. Just main.rs file is not enough.

1 Like

I created main.rs by myself

Can you copy/paste the exact command you ran and all of its output (even if it's a bit long)?

Error messages almost always tell you what went wrong, and we can use that information to figure out how to fix the situation. If we can't see the error message, we'll just be guessing what went wrong.


And make sure to use the code environment with 3 backticks:

Shell commands and ouput go here

So it gets formated nicely like so

~ $ echo hello

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.