1. 程式人生 > 程式設計 >VSCode各語言執行環境配置方法示例詳解

VSCode各語言執行環境配置方法示例詳解

系統環境變數的配置

如:將F:\mingw64\bin新增到系統環境變數Path中

VSCode軟體語言json配置C語言

建立個.vscode資料夾,資料夾內建立以下兩個檔案

launch.json 檔案配置
{
  "version": "0.2.0","configurations": [
 
    {
      "name": "(gdb) Launch","type": "cppdbg","request": "launch",//"program": "enter program name,for example ${workspaceFolder}/a.exe","program": "${file}.o","args": [],"stopAtEntry": false,"cwd": "${workspaceFolder}","environment": [],"externalConsole": true,"MIMode": "gdb","miDebuggerPath": "F:\\mingw64\\bin\\gdb.exe","preLaunchTask": "g++","setupCommands": [
        {
          "description": "Enable pretty-printing for gdb","text": "-enable-pretty-printing","ignoreFailures": true
        }
      ]
    }
  ]
}
c_cpp_properties.json 檔案配置
{
  "configurations": [
    {
      "name": "Win32","includePath": [
        "E:/Opencv_4.1/opencv/build/include","${workspaceRoot}","E:/Opencv_4.1/opencv/build/include/opencv2","F:/mingw64/include"
      ],"defines": [
        "_DEBUG","UNICODE","_UNICODE"
      ],"intelliSenseMode": "msvc-x64","browse": {
        "path": [
          "E:/Opencv_4.1/opencv/build/include","F:/mingw64/include"
        ],"limitSymbolsToIncludedHeaders": true,"databaseFilename": ""
      },"compilerPath": "F:\\mingw64\\bin\\gcc.exe","cStandard": "c11","cppStandard": "c++17"
    }
  ],"version": 4
}

C++語言

建立個.vscode資料夾,資料夾內建立以下兩個檔案

tasks.json 檔案配置
{
  "version": "2.0.0","tasks": [
    {
      "type": "shell","label": "cpp.exe build active file","command": "F:\\mingw64\\bin\\cpp.exe","args": [
        "-I","E:/Opencv_4.1/opencv/build/include","-I","-L","E:/Opencv_4.1/opencv/build/x64/vc14/lib","-g","${file}","-o","${fileDirname}\\${fileBasenameNoExtension}.exe","-l","opencv_core","libopencv_imgproc","libopencv_video","libopencv_ml","libopencv_highgui","libopencv_objdetect","libopencv_flann","libopencv_imgcodecs","libopencv_photo","libopencv_videoio"
      ],"options": {
        "cwd": "F:\\mingw64\\bin"
      },"problemMatcher": [
        "$gcc"
      ]
    },{
      "type": "shell","label": "g++.exe build active file","command": "F:\\mingw64\\bin\\g++.exe","args": [
        "-g","${fileDirname}\\${fileBasenameNoExtension}.exe"
      ],"options": {
        "cwd": "F:\\mingw64\\bin"
      }
    }
  ]
}
c_cpp_properties.json 檔案配置
{
  "configurations": [
    {
      "name": "Win32","includePath": [
        "${workspaceRoot}","F:/mingw64/include/c++"
      ],"browse": {
        "path": [
          "${workspaceRoot}","F:/mingw64/include/c++"
        ],"compilerPath": "F:/mingw64/bin/gcc.exe","version": 4
}

java語言

建立個.vscode資料夾,資料夾內建立以下兩個檔案

c_cpp_properties.json 檔案配置
{
  "configurations": [
    {
      "name": "Win32","F:/mingw64/include/java"
      ],"F:/mingw64/include/java"
        ],"version": 4
}

python語言

建立個.vscode資料夾,資料夾內建立檔案

{

"configurations": [{

"name": "Win32","includePath": [

"${workspaceRoot}","F:/mingw64/include/python"

],"defines": [

"_DEBUG","_UNICODE"

],"browse": {

"path": [

"${workspaceRoot}","databaseFilename": ""

}

}],"version": 3

}

總結

到此這篇關於VSCode各語言執行環境配置方法示例詳解的文章就介紹到這了,更多相關VSCode各語言執行環境配置內容請搜尋我們以前的文章或繼續瀏覽下面的相關文章希望大家以後多多支援我們!