Detailed explanation of vscodeC language, c++, c# environment running configuration (refined step-by-step explanation - understand in seconds)

    Preface: The vs code compiler requires a separate software to be installed for use. Similarly, there are other software that also require running environment software. They all require this software, which can be used after downloading and decompressing it. If you need other compilation software recommendations, you can send a private message or leave a message.

Table of contents:

      1. Download address: (Official website download)

       2. Environment variable configuration

       3. Test: Whether the environment is configured successfully:

       4. Configuration program for vs code environment variables

   4.1 Configuration code (arranged in the order of the three figures above):

   4.2 After the compilation is completed, enter the test code link:


1. Download address: (Official website download)

   链接:MinGW-w64 - for 32 and 64 bit Windows download | SourceForge.net

   Note: The download is very slow. You can choose to leave a message in your private email address and share it permanently for free use.

   Send email to: [email protected]: mingw64 file package to obtain resources

 Download page

click to download

 Be careful not to choose the exe file for installation

 Waiting for download

Selected path download

 After downloading, unzip it as shown above

2. Environment variable configuration

 

 

 You can click to browse and find the file you just decompressed. Select the bin file to set the path.

 Special note: You can only add it to the path, you cannot delete it or create another path.

3. Test: Whether the environment is configured successfully:

win+r调用出:cmd的窗口命令

输入:gcc -v(测试C语言环境)
      g++ -v(测试c++语言环境)

 Test completed environment configuration successfully

4. Configuration program for vs code environment variables

Click to install

 Plug-ins that need to be installed to run C language in vs code

 Plug-ins that need to be installed to run C language in vs code

4.1 Configuration code (arranged in the order of the three figures above):

{
  "configurations": [
    {
      "name": "windows-gcc-x64",
      "includePath": [
        "${workspaceFolder}/**"
      ],
      "compilerPath": "D:/mingw64/bin/gcc.exe",//配置好环境变量后一般会自动识别,如果没有就需要手动添加
      "cStandard": "${default}",
      "cppStandard": "${default}",
      "intelliSenseMode": "windows-gcc-x64",
      "compilerArgs": [
        ""
      ]
    }
  ],
  "version": 4
}
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "C/C++ Runner: Debug Session",
      "type": "cppdbg",
      "request": "launch",
      "args": [],
      "stopAtEntry": false,
      "externalConsole": false,
      "cwd": "e:/student/C/Chanshu",//更改下本地的文件的路径,不能出现中文,
      "program": "e:/student/C/Chanshu/build/Debug/outDebug",//注意更改下路径
      "MIMode": "gdb",
      "miDebuggerPath": "gdb",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ]
    }
  ]
}
{
  "C_Cpp_Runner.cCompilerPath": "gcc",
  "C_Cpp_Runner.cppCompilerPath": "g++",
  "C_Cpp_Runner.debuggerPath": "gdb",
  "C_Cpp_Runner.cStandard": "",
  "C_Cpp_Runner.cppStandard": "",
  "C_Cpp_Runner.msvcBatchPath": "",
  "C_Cpp_Runner.useMsvc": false,
  "C_Cpp_Runner.warnings": [
    "-Wall",
    "-Wextra",
    "-Wpedantic"
  ],
  "C_Cpp_Runner.enableWarnings": true,
  "C_Cpp_Runner.warningsAsError": false,
  "C_Cpp_Runner.compilerArgs": [],
  "C_Cpp_Runner.linkerArgs": [],
  "C_Cpp_Runner.includePaths": [],
  "C_Cpp_Runner.includeSearch": [
    "*",
    "**/*"
  ],
  "C_Cpp_Runner.excludeSearch": [
    "**/build",
    "**/build/**",
    "**/.*",
    "**/.*/**",
    "**/.vscode",
    "**/.vscode/**"
  ]
}

       The compiler needs to find the gcc compilation path, so these three files need to be added for configuration. The configuration code is as above. If you do not have these three files, you can choose to add them manually. The paths involved in the code need to be modified manually. Both the vs code installation path and the configuration path need to use English commands. There will be problems with Chinese and cannot be compiled.

 4.2 After the compilation is completed, enter the test code link:

#include<stdio.h>
int main(){
printf("hello,word!");

    return 0;
}

 Test code

Continue to use after testing is completed

At the end:

 vs code can also write HTML, css, JavaScript, python, Arduino, etc. All need to configure the environment.

The previous article has vscode detailed installation steps

Guess you like

Origin blog.csdn.net/m0_48565215/article/details/125998226