我是 VS Code 的新手,在调试 Fortran 代码时遇到问题,因为断点永远不起作用,并且会被跳过,就好像它们不存在一样。
我做了一个测试程序,遇到同样的问题:
program test
implicit none
real :: x
x = 10.0
print*, x
end program test
Run Code Online (Sandbox Code Playgroud)
如果我在打印语句处放置断点,调试器不会停止。
在运行过程中,断点变为灰色,我收到此消息
Module containing this breakpoint has not yet loaded or the breakpoint address could not be obtained.
Run Code Online (Sandbox Code Playgroud)
这是tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "compile",
"type": "shell",
"command": "gfortran",
"args": [
"test.f90"
],
"options": {
"cdw": "${workspaceRoot}"
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
和这个launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Run GDB",
"type": "cppdbg",
"request": …Run Code Online (Sandbox Code Playgroud) 我想在模块内部定义一些由几个子例程共享的常量,但是当我尝试编译它时会收到很多错误消息(使用-c命令):
错误:MODULE中的意外赋值语句
如果我在子程序中使用相同的代码,它的工作原理.这是模块的代码:
module rkSetup
!High order embedded Runge-Kutta formulae, by P.J.Prince and J.R.Dormand,
!Journal of Computational and Applied Mathematics, vol. 7, 1981, pages 67-75
implicit none
INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND(15)
integer, parameter :: s = 13 ! number of stages
integer, parameter :: p = 8 !< Order of the method
real(dp), dimension(s) :: a !< Runge-Kutta vector of nodes
real(dp), dimension(s) :: c !< Runge-Kutta vector of weigths
real(dp), dimension(s) :: d !< Runge-Kutta vector of …Run Code Online (Sandbox Code Playgroud)