`No Source available` when debugging Intel Fortran in Visual Studio

丶灬走出姿态 提交于 2019-12-12 02:13:37

问题


I am debugging the following Fortran code on Microsoft Visual Studio 2012+Intel Visual Fortran:

program customarray

implicit none
real, allocatable, dimension(:):: vector
integer :: nelements, i
real :: sum

print *, 'enter how many values you have'
read *, nelements
allocate(vector(nelements))
print *, 'enter the values'
sum = 0.0

do i=1,nelements
    read *, vector(i)
    sum = sum+vector(i)
end do

end program customarray

As I step through the code using the debugger "step into" tool. Everything runs as expected. However as soon as I reach the very last line

end program customarray

I get a the following dialog box:

I don't understand why I am getting this error. I am frustrated because it runs smoothly when I "Run without debugging" and does not display the same error.


回答1:


After the end program with Step Into you are entering the code generated by the compiler to finish the program run and return to Windows.

Step Into will enter any function executed by the program, even internal libraries (might be set-up slightly differently for Fortran). See "Step Over" and "Step Into" in Visual Studio

With Step Over or Step Out you should be able to skip this finishing internal code, but with Step Into you are asking the debugger to take you there.

And, of course, no source is available in that region, because that code executed there is not your user code. It may or may not be compiled C code or even parts of machine code directly inserted there by the compiler.

Similar behaviour can happen at the start of the program. You can also enter the procedures executed by the program when preparing the environment to be able to execute your code. If you just want to debug your code, start debugging at a line corresponding to your executable statement.



来源:https://stackoverflow.com/questions/42764229/no-source-available-when-debugging-intel-fortran-in-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!