1. 第一步安装 MINGW-W64
1.1 下载MINGW-W64,地址:https://sourceforge.net/projects/mingw/
具体安装步骤请参考:https://cloud.tencent.com/developer/article/1357939 注意要选择Fortran进行安装,安装完后要配置环境变量
2.查看C:\MinGW\bin安装目录下有没有gdb.exe 如果没有,则在cmd窗口安装 (mingw-get install gdb)
3.Visual Studio Code 搭建
参考:https://blog.youkuaiyun.com/qq_24197463/article/details/89634794
参考:https://www.jianshu.com/p/98e16631c852
注意我是在C:\MinGW\bin中安装的gdb.exe 所以我的 launch.json中 "miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
{
"version": "0.0.1",
"configurations": [
{
"name": "Fortran Launch (GDB)",
"type": "cppdbg",
"request": "launch",
"targetArchitecture": "x86",
"program": "${workspaceRoot}\\${fileBasenameNoExtension}.exe",
"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"externalConsole": true,
"preLaunchTask": "gfortran"
},
{
"name": "Intel Debug Attach",
"type": "cppvsdbg",
"request": "attach",
"processId": "${command:pickProcess}"
}
] }
4.如果vscode 不能打断点,依次打开文件->首选项->设置。并按下图勾选