[rust/getting started] windows installation rust gnu environment (toss)

say up front

  • First of all, I am an entry-level player in rust. I used to write rust in wsl, and suddenly I want to install rust under windows.
  • windows version: windows11 22H2
  • original
  • change source

Mental journey

  • I fell into silence when I saw the tutorial, (official recommendation)
    insert image description here

  • When I opened it Microsoft C++ Build Tools, I was puzzled. This is what made me install vs studio?
    insert image description here

  • I install a rust, how many G environments do you want me to install? Goodbye, farewell! I am a rookie!

  • Wait, isn't there a second way?
    insert image description here

  • Ok, although the download is bumpy, at least MSYS2 is installed; let me see what to do next,
    insert image description here
    after installation, configure the system variables
    insert image description here

  • Then, move! (Stuck in the download, it should be a network problem, after a few interviews, it will be fine again)

    $ curl https://sh.rustup.rs -sSf | sh
    info: downloading installer
    
    
    
  • After that, just follow the tutorial, but the waiting process here still depends on the network environment. After installing it three times, the download speed was only 40KB/s once (the mentality exploded)
    insert image description here

  • Well, now is it possible to be happy cargo run? want peach!

    error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1
      |
    

    I. . .

  • open MSYS2 MINGW64,

    pacman -S mingw-w64-x86_64-gcc
    
  • ok now you can have funcargo run

    PS E:\xxx> cargo run --release
       Compiling eframe_template v0.1.0 (E:\xxx)
        Finished release [optimized] target(s) in 0.86s
         Running `target\release\eframe_template.exe`
    

Make complaints

  • rustThe Windows environment is definitely the most troublesome installation of the language environment I have encountered so far.

Guess you like

Origin blog.csdn.net/qq_33446100/article/details/132119606