大家好,
我试着用Visual Studio (VS) Code编译Fortan程序。首先,我在VS Code里安装了’Modern Fortran‘,'Fortran Breakpoint Support'和'fortran'的extension。然后添加了下面两个文件。
一个文件是launch.json,内容如下:
[Fortran] 纯文本查看 复制代码 "version": "0.0.1",
"configurations": [
{
"name": "Fortran Launch (GDB)",
"type": "cppdbg",
"request": "launch",
"targetArchitecture": "x86",
"program": "${workspaceRoot}\\${fileBasenameNoExtension}.exe",
"miDebuggerPath": "D:/Application_Softwares/MinGW-W64/mingw64/bin/gdb.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"externalConsole": true,
"preLaunchTask": "gfortran"
},
{
"name": "Intel Debug Attach",
"type": "cppvsdbg",
"request": "attach",
"processId": "${command:pickProcess}"
}
] }\
另一个文件是tasks.json,内容如下:
[Fortran] 纯文本查看 复制代码 {
"version": "2.0.0",
"command": "gfortran",
"args": [
"-g",
"${file}",
"-o",
"${workspaceRoot}\\${fileBasenameNoExtension}.exe"
]
}
然后,我运行一个测试程序,内容如下:
[Fortran] 纯文本查看 复制代码 PROGRAM HELLO
IMPLICIT NONE
OPEN (UNIT=3, FILE='hello.dat', STATUS='UNKNOWN')
WRITE (UNIT=3, FMT=*) 'Hello World!'
CLOSE (UNIT=3)
STOP
END PROGRAM HELLO
但VS Code却显示下面的错误信息:
[Fortran] 纯文本查看 复制代码 You don't have an extension for debugging 'Fortran-Morden'. Should we find a 'Fortran-Morden' extension in the Marketplace?
相应的截图如下。
我已经安装了’Modern Fortran‘ extension,为什么还会提示说我没有安装呢?请问要如何解决这个问题呢?
谢谢大家。
|