#How to get vscode to work

59 messages · Page 1 of 1 (latest)

pine crest
# rancid oasis You need that

hey, i am getting this same error, but i am currently on windows 7, when i try to download the Build tools, it directs me to vs 2022 which is not compatible with Windows 7

#

any ideas on how i can download vs 2019 or lower which is compatible with windows 7

rancid oasis
#

You don't need Visual Studio, just the Build Tools

#

You should be able to get the 2019 build tools with a bit of searching on Microsoft's website, I don't know why it redirected you

pine crest
rancid oasis
#

Please ask on #rust-discussions-1 then, there is only me here and I'm not around a computer to help you

#

Hi! I’m here

topaz hill
#

Sorry by the way I dont understand much

rancid oasis
#

Is ok

#

So, forget about whatever state VSCode is now, do you now know where your folder with your main.rs file is on your computer? Can you access it using the file explorer?

topaz hill
#

Yes

#

I'm just trying to figure out how to run it

rancid oasis
#

ok, so what you need to do is ensure you open VSCode with a right-click on the folder, and using this option (in english for you). This will open VSCode in a desirable state, then I can proceed to help you from there

#

If you did things correctly, when VSCode opens, the top left part of the program should look something like this:

#

if it looks like this, don’t worry I’ll help you fix it:

topaz hill
#

okay i got it like the first one

rancid oasis
#

That is great!

#

Now, if you do Ctrl + `, you should be able to open a terminal, can you tell me what the prompt is like?

#

(the part that shows on the last line)

topaz hill
#

i got the terminal open so what do you want to know

rancid oasis
#

Just what the last line shown says

#

Something like PS C:/<a long path>?

#

To ensure your commands will work

#

By the way, you can select text in your terminal by dragging the left-click, and copy it with a right click

#

You can also paste text in it with a right click

topaz hill
#

oh

#

i highlighted it and right clicked and it disappeared

rancid oasis
#

It should be in your clipboard

topaz hill
#

like the highlight

rancid oasis
#

Like when you do Ctrl+C and V

#

Paste it here

#

topaz hill
#

PS C:\Users\Sawyer\Hello World>

rancid oasis
#

great, it should work then

#

type in rustc main.rs in your terminal, then Enter

topaz hill
#

error: linker link.exe not found
|
= note: program not found

note: the msvc targets depend on the msvc linker but link.exe was not found

note: please ensure that VS 2013, VS 2015, VS 2017, VS 2019 or VS 2022 was installed with the Visual C++ option

error: aborting due to previous error

rancid oasis
#

yup, you missed a step when installing Rust, let me get the thing

topaz hill
#

ok

rancid oasis
#

You need that

topaz hill
#

ok

rancid oasis
#

It’s a link, just follow it, download it and install it

#

Put simply, rustc needs it in order to work properly on Windows, but it cannot install it itself because it’s a Microsoft thing and they don’t have the rights for it, so you need to download it separately, from Microsoft’s website

#

I have to make some mayonnaise, I’ll be right back soon

#

Mayonnaise’s done, how are you doing?

topaz hill
#

i clicked the download build tools it appeared in my downloads and i clicked open file blah blah blah its asking me if i want to launch it

rancid oasis
#

Well yes

#

It's an installer

#

Just accept all default settings

topaz hill
#

okay i think they are intalled now

#

ok i ran it and it opened two new files

rancid oasis
#

Yup, that’s normal!

#

Congrats, you’ve got yourself a working Rust setup

#

If you then type ./main, your first program will run!

#

(it just tells the terminal to run ./main.exe, the .exe part is optional)

#

Now, remember these things and you should be okay:

  • Open VSCode on a whole folder, either from the file explorer, or using the File > Open Folder option
  • When using VSCode’s terminal, it opens by default in your opened folder
  • Use VSCode to create files, write in them and save them, use the terminal to run your program
#

Once you get some experience you’ll discover that there are a lot of tools you can use to help you, and nearly all of them will be available from either VSCode or the terminal

#

Since we got VSCode to work, I’m going to leave this post, if you have questions regarding Rust, feel free to ask them in #rust-discussions-1 again 😎