[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

The tasks.json file should add the presentation property `

    "version": "2.0.0",
    "tasks": [
        "label": "compile",
        "type": "shell",
        "command": "gfortran",
        "args": [
        "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: