What is the command string?

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!

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:

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:

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 :slight_smile:)

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.

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:

Personnaly, it fixed a problem I had with MINGW64.

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?

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

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

$ 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

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?

" 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

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.

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

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?

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.

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

Am I filling up my PC with garbage?

1 Like

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

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.

All the packages will be installed in the MSYS2 directory.

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

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.

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.

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.

1 Like

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.