Full stack programmer new toy Rust (a) IDE environment

The most basic process helloword

As we mentioned earlier

The first step, the installation tool chain rust

https://www.rust-lang.org/tools/install

Next, create project

cargo new helloworld

You get a console application template source code as follows

fn main() {
     println!("Hello, world!");
}

The third step is to run the project

cd helloworld

cargo run

Or go directly to execute exe (windows only)


Note: rust in the window under the c ++ compiler needs vs connector, directly put on a vs2019 c ++ can be checked. You can also install vs2019 c ++ Toolkit alone


HERE

rust available IDE is not much choice here vscode

vscode the installation slightly

1. Install plug-in

image

This plug-in installed

2. Open the project

It opened above the door out of the cargo new helloworld project directory

image

Kazakhstan has syntax highlighting

3. Compile the project

Press the default build shortcut key ctrl shift B, menu items

image


image


Kazakhstan, with cargo build the compiler is to compile and generate exe (windows)

cargo check just to make the compiler checks (see if you can compile, if there is a watch model even more convenient, there may be, I beginner)

Point behind the gear icon, you can generate tasks.json

image

try to build it, colored text annotation Important Information

4. Commissioning Project

A breakpoint, hey how can not come (if you do not have control of vscode can break under this section)

image

File->Preferences->Settings

image

Open the settings, check the options as shown in red, you can break down


Press F5 or switch to debug mode is selected add configurationimage

image

I debugging in windows, using c ++ windows debugger can (no doubt, is the c ++ debugger)

image

At this point can not be debugged, there is no good convergence, exe file name to be changed their output

image

I am here is to change this (because I built the project called hello01)

Then you can have fun breakpoint debugging, the default shortcut F5, or switch to debug mode by pressing the small green triangle

Breakpoints hit below

image

Step into the menu out of suspension

image

Monitoring variables, call stack, these breakpoints displayed on the left.

At this point a rust console development environment is complete.

Guess you like

Origin www.cnblogs.com/crazylights/p/12114546.html