Learning data structure this course needs to use C language, but the C disk formatting the author and DevC++ and VS studio are removed. And behind is not heavy, packaging good software, I don’t want to take this time want to C also encapsulate vscode, so start learning configuration environment, reference of this article is mainly [zhihu so-and-so article] (https://zhuanlan.zhihu.com/p/15008208441)

How to install vscode and Chinese will not be repeated, here directly start from the configuration.

Configure C’s compiler Link to heading

Download install Link to heading

In making [MinGW - W64] (https://github.com/msys2/msys2-installer/releases/tag/2025-02-21) to download the latest version of the similar to ` msys2 - x86_64-20250221. E xe ‘such a’.exe ‘file ending in’ -x86_64 ‘. Follow all software installation steps

Configure the toolchain Link to heading

In the reference [article] (https://zhuanlan.zhihu.com/p/15008208441) recommended method is to directly open the purple MSYS2. Exe (of course, as with other colors also does not affect), run the command on the command line

pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain
` ` `
Then enter or yes to download. However, I found that if the installation is not in accordance with the default C disk position, this method will report an error
```bash
error: failed to init transaction (unable to lock database)
error: could not lock database: Permission denied
` ` `
Then, if you use sudo, you'll get an error
```bash
Sudo has been disabled on this computer. To enable it, go to the Developer Settings page Settings application
` ` `
This means that you cannot use sudo to represent an administrator here.
How to solve it?
The method is to exit the terminal, directly right-click the icon, open 'MSYS2.exe' in administrator mode, and then you will find that the "$" before the input has changed to" # ", which means that you are directly into administrator mode! Running the above command from this location will succeed.

! [alt text](administrator mode.png)

After he downloads, he can temporarily log out of the terminal
### Configure environment variables
The method is generally common to all software
Open the environment variable, create a new location in the user's environment variable "Path", enter the location of '~\ucrt64\bin', where ~ is the installation path you just MSYS2, confirm the save, exit

### Detect the configuration
Enter the following command in the cmd of window
```bash
gcc --version
g++ --version
gdb --version
` ` `
If no errors are reported and version information is displayed, the compiler configuration is successful.
Configuration in vscode
### Install extensions
Install the C/C++ Extension in vscode and optionally install the C/C++ Extension Pack