代码之家  ›  专栏  ›  技术社区  ›  fireball.1

无法运行Fortran的调试器。Visual Studio代码

  •  0
  • fireball.1  · 技术社区  · 7 年前

    我试图在visual studio代码(ubuntu 18.04)上调试一个fortran文件。

    我安装了以下扩展

    enter image description here

    我的launch.json文件如下

    "version": "0.0.1",
    "configurations": [
        {
            "name": "Fortran Launch (GDB)",
            "type": "cppdbg",
            "request": "launch",
            "targetArchitecture": "x86",
            "program": "${workspaceRoot}/./a.out",
            "miDebuggerPath": "gdb",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceRoot}",
            "externalConsole": true,
            "preLaunchTask": "gfortran"
        }
    ]
    

    因为我使用的是linux,所以我不需要给出gfortran的路径。另外,我尝试通过更改launch.json .exe 到Linux扩展。我已经在问题中更新了。但是调试器仍然没有运行,并在控制台中给出以下错误

    and "show warranty" for details.
    This GDB was configured as "x86_64-linux-gnu".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word".
    =cmd-param-changed,param="pagination",value="off"
    Stopped due to shared library event (no libraries added or removed)
    Loaded '/lib64/ld-linux-x86-64.so.2'. Symbols loaded.
    Breakpoint 1, 0x0000555555554a60 in main ()
    [Inferior 1 (process 24472) exited normally]
    The program '/home/m/gSoC/GasSimulator/./a.out' has exited with code 0 (0x00000000).
    
    1 回复  |  直到 7 年前
        1
  •  0
  •   Natsfan    7 年前

    转到“代码/首选项”菜单项下的“设置”,然后在出现的搜索框中输入Fortran。你会看到一行字: "fortran.gfortranExecutable": "gfortran",

    该行的标题为:/,指定gfortran可执行文件的完整路径。

    所以试着将gfortran改为输入时得到的响应 which gfortran 在终端的命令行上。

    您可能还需要将json文件中的“prelaunchtask”变量更改为gfortran路径。

    推荐文章