I am able to run "hello_rust" from the terminal, but

not in VSC. The paths all look the same.



This looks like you've got an older version of rust running.
In the vscode terminal, run

rustup update

stable-i686-pc-windows-msvc unchanged - rustc 1.35.0 (3c235d560 2019-05-20)

Is this current ?

I think you called cargo run from c:/Users/Paul/Rust and not c:/Users/Paul/Rust/ferris_says based on the error in the bottom right corner of VSCode.

Yes that is up to date.

Do I need "extern crate" ?

The command line that VSCode executes is the problem: it does

cd ...\ferris_says\src && rustc main.rs

when instead it should be doing cargo build and/or cargo run. (You can see that at the top of the Output window.)

With a standalone invocation of rustc like that, it has no idea that it's part of a crate called ferris_says.

That said, not being a VSCode user I don't know why it does that.

What IDE / Editor do you use ?

Note: it is not use extern crate ferris_says::say; but

use ::ferris_says::say;

(An added extern crate ferris_says; declaration used to be required for external (i.e., not std) crates, but since the 2018 edition, cargo takes care of this).

I'm using Emacs myself.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.