# I can't run fortran code with VS Code

**URL:** <https://fortran-lang.discourse.group/t/i-cant-run-fortran-code-with-vs-code/10411>\
**Category:** Uncategorized\
**Created:** [September 18, 2025, 4:34am UTC](https://fortran-lang.discourse.group/t/i-cant-run-fortran-code-with-vs-code/10411 "2025-09-18T04:34:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DancingTiger](https://avatars.discourse-cdn.com/v4/letter/d/4da419/32.png) [@DancingTiger](https://fortran-lang.discourse.group/u/DancingTiger)\
**Post date:** [September 18, 2025, 4:34am UTC](https://fortran-lang.discourse.group/t/i-cant-run-fortran-code-with-vs-code/10411/1 "2025-09-18T04:34:36Z")

</div>

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

This only occurs when trying it through VS code, when I run it on the command line, it works on fine.

---

<div class="post-metadata">

**Author:** ![hkvzjal](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/hkvzjal/32/3055_2.png) [@hkvzjal](https://fortran-lang.discourse.group/u/hkvzjal)\
**Post date:** [September 18, 2025, 10:37am UTC](https://fortran-lang.discourse.group/t/i-cant-run-fortran-code-with-vs-code/10411/2 "2025-09-18T10:37:53Z")

</div>

The problem is not VS Code. You are executing the command from a “PowerShell” (PS) terminal which is slightly different to a “command line” terminal. It is possible that within the PS terminal your installation of gnu compilers is not visible.

If you see to the right of the console panel, you’ll see " \> powershell +" and a small arrow downwards. Click on the arrow and it enables you to open different kind of terminals. You’ll see also the “command line”. You can use that as well directly within the VS Code workspace. Then you can try and check why the gnu compilers are not directly visible perse from PS.

---

<div class="post-metadata">

**Author:** ![davidpfister](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/davidpfister/32/3949_2.png) [@davidpfister](https://fortran-lang.discourse.group/u/davidpfister)\
**Post date:** [September 18, 2025, 11:19am UTC](https://fortran-lang.discourse.group/t/i-cant-run-fortran-code-with-vs-code/10411/3 "2025-09-18T11:19:50Z")

</div>

The problem seems to be that gfortran is not in your PATH. If you are on Windows and installed gfortran from MSYS2, the environment variables are not always updated and you should add the folder where gfortran seats manually to your PATH variables.

Don’t forget to restart vscode to get the updated variables.
