[Solved] VsCode + gfortran Compiler Error: error: ld returned 1 exit status

After a file is executed in the VsCode control panel, if a new f90 file is created (multiple programs share the same panel port), an error message as shown in the figure will often appear

Solution:
The tasks.json file should add the presentation property `

{
    "version": "2.0.0",
    "tasks": [
      {
        "label": "compile",
        "type": "shell",
        "command": "gfortran",
        "args": [
          "-g",
          "${file}",
          "-o",
          "${workspaceRoot}\\${fileBasenameNoExtension}.exe"
        ],
        "problemMatcher": [],
        "group": {
          "kind": "build",
          "isDefault": true
        },
        "presentation": {
          "echo": true,
          "reveal": "always",
          "focus": false,
          "panel": "new", //Here shared means shared, after changing to new each process creates a new port
          "showReuseMessage": true,
          "clear": false
        }
      }
    ]
  }

“Shared” indicates sharing. After changing to new, each process creates a new port.

Read More: