# Code Not Executing | What am I doing wrong

**URL:** <https://fortran-lang.discourse.group/t/code-not-executing-what-am-i-doing-wrong/5282>\
**Category:** Help\
**Created:** [February 26, 2023, 12:01am UTC](https://fortran-lang.discourse.group/t/code-not-executing-what-am-i-doing-wrong/5282 "2023-02-26T00:01:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![warhammer](https://avatars.discourse-cdn.com/v4/letter/w/4da419/32.png) [@warhammer](https://fortran-lang.discourse.group/u/warhammer)\
**Post date:** [February 26, 2023, 12:01am UTC](https://fortran-lang.discourse.group/t/code-not-executing-what-am-i-doing-wrong/5282/1 "2023-02-26T00:01:34Z")

</div>

Hi ! I am a newbie to Fortran. I installed the GFortran via TDM-GCC, followed the installation wizard as was recommended. For the Editor I installed Geany.

Now I wrote a program in Geany called ‘area\_of\_circle.f90’ and saved it in the TDM-GCC-64 Folder on my C Drive (where GFortran was installed).

The issue is when I am trying to compile the program in MinGW Command Prompt, it is just not executing. I enter gfortran “filename.f90”, it waits up for a few seconds and then does nothing. I have tried all the recommended ways including reinstalling GFortran et al. My code is also fine without any issues.

Below I have linked a few screenshots of my program as well as the MinGW Commands. I request someone to please guide me! I use a Win11 x64 System.

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

---

<div class="post-metadata">

**Author:** ![warhammer](https://avatars.discourse-cdn.com/v4/letter/w/4da419/32.png) [@warhammer](https://fortran-lang.discourse.group/u/warhammer)\
**Post date:** [February 26, 2023, 12:02am UTC](https://fortran-lang.discourse.group/t/code-not-executing-what-am-i-doing-wrong/5282/2 "2023-02-26T00:02:14Z")

</div>

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

This is the Second Image mentioned in Post 1

---

<div class="post-metadata">

**Author:** ![egio](https://avatars.discourse-cdn.com/v4/letter/e/dbc845/32.png) [@egio](https://fortran-lang.discourse.group/u/egio)\
**Post date:** [February 26, 2023, 12:07am UTC](https://fortran-lang.discourse.group/t/code-not-executing-what-am-i-doing-wrong/5282/3 "2023-02-26T00:07:38Z")

</div>

Try

gfortran -o area\_of\_circle.exe area\_of\_circle.f90  
area\_of\_circle.exe

The first instruction compile and link it, the second one execute it.

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [February 26, 2023, 1:36am UTC](https://fortran-lang.discourse.group/t/code-not-executing-what-am-i-doing-wrong/5282/4 "2023-02-26T01:36:38Z")

</div>

To automate running a program after compiling it, you can define a batch file called gfrun.bat (for example)

```auto
@ echo off
:: compile a Fortran program with up to 9 source files with gfortran and run the executable
setlocal
if exist a.exe del a.exe
gfortran -Wall -Wextra -fbounds-check %1 %2 %3 %4 %5 %6 %7 %8 %9
if exist a.exe a.exe

```

and then issue a command

`gfrun.bat area_of_circle.f90`

I use such a batch file to try out small programs.

---

<div class="post-metadata">

**Author:** ![Dobrodzieju](https://avatars.discourse-cdn.com/v4/letter/d/c5a1d2/32.png) [@Dobrodzieju](https://fortran-lang.discourse.group/u/Dobrodzieju)\
**Post date:** [February 26, 2023, 9:54am UTC](https://fortran-lang.discourse.group/t/code-not-executing-what-am-i-doing-wrong/5282/5 "2023-02-26T09:54:32Z")

</div>

Just press the Build command button in Geany toolbar and then press the Execute button. With “Set Build Commands” from pull down menu, you can add more options to compiling and linking processes.
