# Configure compiler options using Gfortran on VScode

**URL:** <https://fortran-lang.discourse.group/t/configure-compiler-options-using-gfortran-on-vscode/5502>\
**Category:** Visual Studio Code\
**Created:** [April 4, 2023, 12:56pm UTC](https://fortran-lang.discourse.group/t/configure-compiler-options-using-gfortran-on-vscode/5502 "2023-04-04T12:56:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![steelclam](https://avatars.discourse-cdn.com/v4/letter/s/c0e974/32.png) [@steelclam](https://fortran-lang.discourse.group/u/steelclam)\
**Post date:** [April 4, 2023, 12:56pm UTC](https://fortran-lang.discourse.group/t/configure-compiler-options-using-gfortran-on-vscode/5502/1 "2023-04-04T12:56:56Z")

</div>

I am using VScode (the most recent version) and Gfortran (12.2.0), on Windows 11, to learn Fortran 90-2008. I have installed the extensions “Modern Fortran”, “Code Runner”, and “C/C++”, so I can compile and run my .f90 program easily with a single click, and all works fine.

However, I cannot find WHERE to declare compiler options, like “-fcheck=all -g -O0 -fbacktrace” on the extensions’ configurations, so when I click on “Run code” (on VScode), it would compile with those options by default. Could you guys help me? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Euler-37](https://avatars.discourse-cdn.com/v4/letter/e/b19c9b/32.png) [@Euler-37](https://fortran-lang.discourse.group/u/Euler-37)\
**Post date:** [April 5, 2023, 3:37am UTC](https://fortran-lang.discourse.group/t/configure-compiler-options-using-gfortran-on-vscode/5502/2 "2023-04-05T03:37:45Z")

</div>

Code Runner’s `settings.json`

---

<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:** [April 5, 2023, 6:38am UTC](https://fortran-lang.discourse.group/t/configure-compiler-options-using-gfortran-on-vscode/5502/3 "2023-04-05T06:38:14Z")

</div>

Welcome to the Discourse @steelclam.  
If you are using the Modern Fortran pre-release version you don’t need Code runners to compile, run and/or debug individual Fortran files.  
Open the vscode settings and add your options, to `fortran.linter.extraArgs` like this

```auto
"fortran.linter.extraArgs": [
    "-fdefault-real-8",
    "-fdefault-double-8",
    "-Wunused-variable",
    "-Wunused-dummy-argument"
  ]

```

Note: put one argument per string.  
If you want to use Code Runner I would suggest you have a quick read at their settings/examples

---

<div class="post-metadata">

**Author:** ![steelclam](https://avatars.discourse-cdn.com/v4/letter/s/c0e974/32.png) [@steelclam](https://fortran-lang.discourse.group/u/steelclam)\
**Post date:** [April 12, 2023, 3:56pm UTC](https://fortran-lang.discourse.group/t/configure-compiler-options-using-gfortran-on-vscode/5502/4 "2023-04-12T15:56:38Z")

</div>

> [@gnikit](#):
>
> ```auto
> "fortran.linter.extraArgs": [
> "-fdefault-real-8",
> "-fdefault-double-8",
> "-Wunused-variable",
> "-Wunused-dummy-argument"
> ]
> 
> ```

Thanks a lot!! I’ll give a try and say if it works.
