How to Compile and Run Rust Program

This post explains how to compile and run rust Program

For following below instructions rust and VsCode installation is required, if you don't have rust installed, follow link install rust on windows.

  • Create a Project folder from CMD
    E:\rust-tutorials>mkdir first-project
  • Navigate to created folder and open VsCode in it.
    E:\rust-tutorials>cd first-project
    E:\rust-tutorials\first-project>code .
  • Now, in VsCode create a file and write below code and save the file
    fn main() {
        println!("Hello, rust!");
  • To compile the Rust program , open the terminal and execute below command
  • To run the Rust program, execute below command

    Successful execution will print "Hello, rust!" in the terminal