# Compiling hello.f90 with Visual Studio Code for WSL

**URL:** <https://fortran-lang.discourse.group/t/compiling-hello-f90-with-visual-studio-code-for-wsl/4888>\
**Category:** Visual Studio Code\
**Created:** [December 8, 2022, 5:31pm UTC](https://fortran-lang.discourse.group/t/compiling-hello-f90-with-visual-studio-code-for-wsl/4888 "2022-12-08T17:31:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![prusso75](https://avatars.discourse-cdn.com/v4/letter/p/65b543/32.png) [@prusso75](https://fortran-lang.discourse.group/u/prusso75)\
**Post date:** [December 8, 2022, 5:31pm UTC](https://fortran-lang.discourse.group/t/compiling-hello-f90-with-visual-studio-code-for-wsl/4888/1 "2022-12-08T17:31:12Z")

</div>

I have:  
Distributor ID: Ubuntu  
Description: Ubuntu 22.04.1 LTS  
Release: 22.04  
Codename: jammy

with code:  
~/prusso/fortranhello/hello.f90:  
program hello  
print \*, “Hello World!”  
end program

I have installed VS Code on the windows side for WSL as well as the Modern Fortran Extension for WSL as well as fortls which I installed via:

pip install fortls

which installed and VS Code notified me that fortls was installed and initialized. So far when I click the run button or the build task menu item in VS Code nothing happens. There is in the lower right hand corner an icon stating that Fortran is the current language. I did read the documentation about the launch.json however so far try as I might I was not able to get VS Code to compile and debug anything yet. Can someone please let me know what has to be done from this point to get hello.f90 to compile and debug with the Modern Fortran extension for WSL?

Thanks…

So I did put in a launch.json which now does execute and I have the print statement coming out after installing the WSL gdb extension however the debugger does not stop at any breakpoints it just continues past them and the program returns with exit code 0. Why are the breakpoints not working?

---

<div class="post-metadata">

**Author:** ![gnikit](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/gnikit/32/1213_2.png) [@gnikit](https://fortran-lang.discourse.group/u/gnikit)\
**Post date:** [December 8, 2022, 8:07pm UTC](https://fortran-lang.discourse.group/t/compiling-hello-f90-with-visual-studio-code-for-wsl/4888/2 "2022-12-08T20:07:52Z")

</div>

Hi @prusso75 welcome to the Fortran-lang Discourse

> [@prusso75](#):
>
> Can someone please let me know what has to be done from this point to get hello.f90 to compile and debug with the Modern Fortran extension for WSL?

You didn’t specify the Modern Fortran version but I will assume you are using the pre-Release since compile and debug buttons are currently only available there. Pressing the Debug button should work AFAIK. Could you post the output of your Modern Fortran Output channel, after you have set the logging level to `Debug` in your settings

 ![image](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/3/33c4b8455540dfae361160ff6710c11680c11e49.png)

 ![image](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/7/7401bac602dd69b2cd9530917d726fcafaac6fde.png)

* * *

> [@prusso75](#):
>
> debugger does not stop at any breakpoints it just continues past them and the program returns with exit code 0. Why are the breakpoints not working?

You need to add in your `launch.json` arguments to compile with debug symbols `-g`

---

<div class="post-metadata">

**Author:** ![prusso75](https://avatars.discourse-cdn.com/v4/letter/p/65b543/32.png) [@prusso75](https://fortran-lang.discourse.group/u/prusso75)\
**Post date:** [December 11, 2022, 7:56pm UTC](https://fortran-lang.discourse.group/t/compiling-hello-f90-with-visual-studio-code-for-wsl/4888/3 "2022-12-11T19:56:46Z")

</div>

Much gratitude you have pointed that out to me. So beyond adding in place of [“-g”] for arguments inside launch.json also I was able to find Logging settings for a C\_Cpp system belonging to VS Codes settings dialog for some reason it wasn’t under Fortran settings on my particular machine that I also set to “Debug”.  
So I tried to post the terminal out but I got a dialog that says new users can not post more than two links.

Thank you
