This is my third day trying to install GCC

After instalation my compiler is here:
c:\users\pader\gcc\x86_64-W64-mingw32

my test program is here: j:\x\trialOne.f90

If I attempt to compile I get this:

J:>gfortran trialOne.f90 -o a.exe
‘gfortran’ is not recognized as an internal or external command,
operable program or batch file.

Should I open a DOS window and enter this: (???)
set path=c:\users\pader\gcc\ %path%

Please no narrative, just tell me do this: . . . i.e. what to type in where,

Look for the directory that contains the executable “gfortran.exe” and fill in that name in the command. I do not think “c:\users\pader\gcc” is the one you need, but I am not sure whether you need to add “bin” at the end or 'x86_64_W64-mingw32".

This is where Gfortran is
c:\users\pader\gcc\bin\gfortran
So, opening a DOS window: what do I type in to create a path to the compiler?

Is it (???)
set path=c:\users\pader\gcc\ gcc\bin;%path%
or is it
set path=c:\users\pader\gcc\ gcc\bin\gfortran;%path%

Supposing the path string is wrong. How do I get rid of it again later?

Use the first version of the “set path” command.

If you open a new command window, it will have the default environment variables.

And, do not get me wrong, but you could have tried these commands yourself and see whether the compiler can be found.

I certainly could have tried the statements, and I do respect you for saying so, but yesterday I crashed my system trying to get the compiler to run, and Microsoft repairing it, was busy a few hours, before it was running again.

I am grateful for your reply.

Supposing the path string is wrong. How do I get rid of it again later?

Using the “set” command to modify the “PATH” environment variable makes only temporary changes that are effective only for the current session of the command prompt. Once you close the command prompt window or restart your computer, the changes will be lost.

Maybe that is why it did not work then?

Try the set command and directly after this type just gfortran into the same window.

C:>set path=c:\users\pader\gcc\ gcc\bin;%path%

C:>gfortran -c j:\x\trialOne.f90
‘gfortran’ is not recognized as an internal or external command,
operable program or batch file.

So what now?

The path you added is wrong: it should have been “c:\users\pader\gcc\bin”, you doubled the “gcc” bit.

As for your computer crashing: that is a rather unusual occurrence. I would not have expected that, as the software you installed is not likely to do much in the foundations of the operating system.

Yes that was dumb. More probs

C:>gfortran -c j:\x\testOne.f90
gfortran: error: j:\x\testOne.f90: No such file or directory
gfortran: fatal error: no input files
compilation terminated.

The system collapsing. It took hours to repair.
And I thought the automatic repair was jolly clever of Microsoft

1 Like

At the very least the compiler is running now :slight_smile:

1 Like

Does the file exist? What is the result of

C:>dir j:\x\testOne.f90

What if you move to the directory where the source file is supposed to be with

C:>cd /d j:\x

and then try dir testOne.f90 or gfortran testOne.f90

To be a programmer you must understand the basics of how your operating system works.

1 Like

“To be a programmer you must understand the basics of how your operating system works.” How well are you informed about how the engine of your car really works? I am no friend of Microsoft. Even the concept of “Windows” they borrowed from Xerox.

“At the very least the compiler is running now :slight_smile:” Of all the information that came my way yours was the only information that didn’t send me tail biting in circles.

@Patrick welcome to the Fortran discourse. I am happy that you were able to get the issue resolved. Please don’t forget to thank the people who helped you. Also a reminder that we have a code of conduct: https://fortran-lang.discourse.group/t/welcome-to-discourse, please follow it.

@Patrick , you will find in this community fans of Windows, Linux, macOS, FreeBSD and other systems. Although Fortran was born before all of them, it needs them to work. All these operating systems share some common concepts that must be learned to program in Fortran or whatever other language. There is a book about the history of Fortran subtitled “Abstracting away the machine”, but that is only an ideal that is never really achieved.