0

I am very new to rust, and I was trying to create a simple hello world program. When in tried to run the program in VSCode using rustc main.rs, I got the error "'rustc' is not recognized as an internal or external command,operable program or batch file." Then when I opened a seperate cmd terminal (by typing cd into the search bar), the command worked fine. rustc --version also worked fine in this new terminal. I do have the rust-analyser extension installed. I am on Windows 10. Thanks

I tried to use the rustc command in the terminal inside VSCode but I got the error above.

all_caps
  • 29
  • 4
  • 1
    First, never use `rustc` directly, always use `cargo`. Now to your actual problem: probably the `PATH` in your vscode terminal is not the same as in your system-wide terminal. It is PowerShell? – Chayim Friedman Aug 29 '23 at 13:19
  • I'm pretty sure that the paths were the same. I tried with both cmd and powershell. – all_caps Aug 29 '23 at 13:49
  • 1
    Have you by any chance not restarted VSCode after installing rust toolchain? – Ivan C Aug 29 '23 at 13:59
  • Thanks, I had only created a new window rather than restarting VSCode completely. It works fine now. – all_caps Aug 29 '23 at 14:45

0 Answers0