# What is the command string?

**URL:** <https://fortran-lang.discourse.group/t/what-is-the-command-string/5552>\
**Category:** Help\
**Created:** [April 13, 2023, 4:57am UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552 "2023-04-13T04:57:47Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrick](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/patrick/32/3170_2.png) [@Patrick](https://fortran-lang.discourse.group/u/Patrick)\
**Post date:** [April 13, 2023, 4:57am UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552/1 "2023-04-13T04:57:47Z")

</div>

I downloaded MYSYS2-X86-64-202318  
It creates a number of shortcuts, one of which is  
MSYS2MINGW64  
When clicked it gives a DOS box for entry  
I presume this is the tight place for entering a command string to compile a Fortran program. If all this is okay,  
What would be the command string to effect compilation?  
Supposing the program name is “TrialOne”.  
Please help: rooky!

---

<div class="post-metadata">

**Author:** ![Arjen](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Arjen](https://fortran-lang.discourse.group/u/Arjen)\
**Post date:** [April 13, 2023, 6:25am UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552/2 "2023-04-13T06:25:37Z")

</div>

Welcome to the forum!

The compiler suite that you have most likely installed is GCC. The Fortran compiler is called gfortran. If you have a source file called TrialOne.f90, then you can compile it using:

```auto
gfortran -c TrialOne.f90

```

The option -c means: compile only.

Simple programs often consist of one source file only and then it suffices to do:

```auto
gfortran -o TrialOne TrialOne.f90

```

The option -o followed by “TrialOne” (or some ohter name) indicates that you want the resulting executable file to be called “TrialOne.exe”. You can also leave it out, in which the executablle will be called “a.exe” (from the UNIX tradition 🙂)

Things get more complicated if your program consists of multiple source files or uses libraries and such. But this should get you started.

One caveat: merely installing MSYS2/MinGW may not bring in any packages like the GCC compiler suite. You will have to install them explicitly in that case.

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [April 13, 2023, 7:23am UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552/3 "2023-04-13T07:23:20Z")

</div>

> [@Patrick](#):
>
> It creates a number of shortcuts, one of which is  
> MSYS2MINGW64

Welcome Patrick to the Discourse!

Note that the environment UCRT64 may be a better choice than MINGW64, as it uses more recent Microsoft C standard library, as stated here:

> **[MSYS2 - Environments](https://www.msys2.org/docs/environments/)**
>
> The differences between the environments is mainly between environment variables, default compilers/linkers, architecture, system libraries used etc.

Personnaly, it fixed a problem I had with MINGW64.

---

<div class="post-metadata">

**Author:** ![Patrick](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/patrick/32/3170_2.png) [@Patrick](https://fortran-lang.discourse.group/u/Patrick)\
**Post date:** [April 13, 2023, 1:59pm UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552/4 "2023-04-13T13:59:15Z")

</div>

Under the icon on the taskbar I have available  
MSYS2 UCRT64 shell  
Clicking it I get a DOS box  
If I enter “gfortran” the response is “file not found”  
What should I do?

---

<div class="post-metadata">

**Author:** ![Arjen](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Arjen](https://fortran-lang.discourse.group/u/Arjen)\
**Post date:** [April 13, 2023, 2:22pm UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552/5 "2023-04-13T14:22:09Z")

</div>

You will need to install the GCC package with Fortran included.

The package manager is called pacman. I am not entirely sure what the name of the package(s) is that you need, but try:

pacman -Ss gfortran

and then:

pacman -S whatever-name-was-reported

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [April 13, 2023, 2:30pm UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552/6 "2023-04-13T14:30:29Z")

</div>

Yes, you should use the MSYS2 terminal to install and update. For example:

```bash
$ pacman -S mingw-w64-ucrt-x86_64-toolchain base-devel

```

will install gcc, gdb, gfortran, python, make, pkgconf…

See also [Installation · vmagnin/gtk-fortran Wiki · GitHub](https://github.com/vmagnin/gtk-fortran/wiki/Installation#windows)

---

<div class="post-metadata">

**Author:** ![Patrick](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/patrick/32/3170_2.png) [@Patrick](https://fortran-lang.discourse.group/u/Patrick)\
**Post date:** [April 13, 2023, 2:47pm UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552/7 "2023-04-13T14:47:21Z")

</div>

I downloaded msys2-x86\_64-20230318  
that unpacks to a whole lot of files,  
one of which is MINGW64  
is that not good?  
If not, what should I do?

---

<div class="post-metadata">

**Author:** ![Patrick](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/patrick/32/3170_2.png) [@Patrick](https://fortran-lang.discourse.group/u/Patrick)\
**Post date:** [April 13, 2023, 2:55pm UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552/8 "2023-04-13T14:55:19Z")

</div>

" you should the MSYS2 terminal "

Is the missing word “use”?  
What is the the MSYS2 terminal?  
I haven’t the faintest idea what to do: I am totally stuck

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [April 13, 2023, 3:04pm UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552/9 "2023-04-13T15:04:02Z")

</div>

Yes, sorry.

> The **MSYS** environment contains the unix-like/cygwin based tools, lives under `/usr` and is special in that it is always active. All the other environments inherit from the **MSYS** environment and add various things on top of it.

Use the MSYS2 window (terminal) to install you packages.  
Then work in the UCRT64 window, rather than MINGW64.

It’s a Unix-like environment.

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [April 13, 2023, 3:09pm UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552/10 "2023-04-13T15:09:23Z")

</div>

In MSYS2 you can install for example:

build tools (it will install gcc, gdb, gfortran, python, make, pkgconf…):

```
$ pacman -S mingw-w64-ucrt-x86_64-toolchain base-devel

```

git:

```
$ pacman -S git

```

Fortran Package Manager fpm:

```
$ pacman -S mingw-w64-ucrt-x86_64-fpm

```

---

<div class="post-metadata">

**Author:** ![Patrick](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/patrick/32/3170_2.png) [@Patrick](https://fortran-lang.discourse.group/u/Patrick)\
**Post date:** [April 13, 2023, 3:16pm UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552/11 "2023-04-13T15:16:35Z")

</div>

I have typed in:

$ pacman -S mingw-w64-ucrt-x86\_64-toolchain base-devel

I get a long list of options

WHICH OPTION SHOULD I SELECT?

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [April 13, 2023, 3:50pm UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552/12 "2023-04-13T15:50:29Z")

</div>

What options are proposed?

It’s normal that a long list of packages will be installed by that command. Just say Yes, if there is no other question.

---

<div class="post-metadata">

**Author:** ![Patrick](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/patrick/32/3170_2.png) [@Patrick](https://fortran-lang.discourse.group/u/Patrick)\
**Post date:** [April 13, 2023, 3:51pm UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552/13 "2023-04-13T15:51:41Z")

</div>

The pc is working overtime lots of yellow warnings  
this cannot be right

Am I filling up my PC with garbage?

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [April 13, 2023, 3:52pm UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552/14 "2023-04-13T15:52:06Z")

</div>

Just copy/past from the MSYS2 terminal if needed (mouse selection + right click for the contextual menu).

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [April 13, 2023, 3:56pm UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552/15 "2023-04-13T15:56:27Z")

</div>

Downloading and installing may take a while (5 minutes ?). It’s slower than native windows, and I suspect that antivirus softwares are slowing everything in MSYS2.

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [April 13, 2023, 4:01pm UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552/16 "2023-04-13T16:01:33Z")

</div>

> [@Patrick](#):
>
> Am I filling up my PC with garbage?

All the packages will be installed in the MSYS2 directory.

Have you followed all the instructions of this page when installing MSYS2?

> **[MSYS2](https://www.msys2.org/)**
>
> Software Distribution and Building Platform for Windows

---

<div class="post-metadata">

**Author:** ![Patrick](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/patrick/32/3170_2.png) [@Patrick](https://fortran-lang.discourse.group/u/Patrick)\
**Post date:** [April 13, 2023, 4:07pm UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552/17 "2023-04-13T16:07:13Z")

</div>

I downloaded MSYS2 X86 64-202318 which unpacked into a lot of files.

I am getting nothing but yellow warnings. All this doesn’t look so user friendly.

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [April 13, 2023, 4:08pm UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552/18 "2023-04-13T16:08:46Z")

</div>

> [@Patrick](#):
>
> am getting nothing but yellow warnings. All this doesn’t look so friendly

You can try to uninstall MSYS2, then try again if you think things are going wrong. They should not…

You may also watch a few videos on YouTube to have an idea of what you should expect.

---

<div class="post-metadata">

**Author:** ![Patrick](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/patrick/32/3170_2.png) [@Patrick](https://fortran-lang.discourse.group/u/Patrick)\
**Post date:** [April 13, 2023, 4:10pm UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552/19 "2023-04-13T16:10:22Z")

</div>

I sopped the stuff coming in. No idea where it all went. Uninstalling msys2 and reinstalling it will end me up with exactly the same.

I don’t think we are getting anywhere. Thank you for trying.  
bye for now.

---

<div class="post-metadata">

**Author:** ![Patrick](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/patrick/32/3170_2.png) [@Patrick](https://fortran-lang.discourse.group/u/Patrick)\
**Post date:** [April 13, 2023, 4:36pm UTC](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552/20 "2023-04-13T16:36:49Z")

</div>

I have installed MSYS2X86 64-2023 and extracted a long list of options. One of them is mingw64, another is ucrt64. When selected I get a DOS window. Entering "gfortran " in either of those two windows leads to an error “file not found” being displayed.

I do not know what to do now, in order to arrive at a situation in which I can simply compile a program. I am spending multiple hours on this, and it is getting me absolutely nowhere.

[Next page](https://fortran-lang.discourse.group/t/what-is-the-command-string/5552.md?page=2)
