Search code examples
visual-studiofortran

Problems with debugging Fortran in Visual Studio 2022


I recently downloaded the Intel oneAPI HPC Toolkit to try some Fortran development in Visual Studio. The installation worked, and I can make Fortran projects and files. However I can't debug or run them. Is there any way to fix this?


Solution

  • Are you sure you can't run them or are they running so fast that the program starts and finishes in a blink of an eye.

    1. Pop up the source
    2. Move the cursor to the first executable statement. Then press F9. A red dot will appear on the left of the code. This indicates a breakpoint. If you get a red circle, it means that the breakpoint cannot be set and you are possibly running an old version of the code
    3. Move the cursor to the last executable statement. Press F9. Again, another red dot will appear.
    4. Run by pressing F5
    5. The code should stop - there will now be a yellow arrow => on top of the red dot.
    6. Press F5 to resume the code. It will stop at the last statement.