MinGW--New to it

W

W. eWatson

Maybe the procedure outlined below is the same for C++ to Fortran.

Apparently, there's a package called MinGW that includes several
languages, C, C++, fortran, ... for Windows. I use Win7, 64-bit. I
downloaded mingw-get-inst-201111118.exe the other day for an install. At
one point it asked what compilers I wanted. I checked only fortran
(Gfortran, I believe). When it completed the install I could not find
any compiler, but did find some sort of "mingw.get..." exe file. Am I
supposed to execute it to get the fortran compiler?
 
G

Geoff

Maybe the procedure outlined below is the same for C++ to Fortran.

Apparently, there's a package called MinGW that includes several
languages, C, C++, fortran, ... for Windows. I use Win7, 64-bit. I
downloaded mingw-get-inst-201111118.exe the other day for an install. At
one point it asked what compilers I wanted. I checked only fortran
(Gfortran, I believe). When it completed the install I could not find
any compiler, but did find some sort of "mingw.get..." exe file. Am I
supposed to execute it to get the fortran compiler?

Did you read the Getting Started documentation on the mingw.org web
site?

You must set the PATH variable for the command line tools, the default
installation for those tools is "\mingw\bin\" or "Program
Files\mingw\bin". The installation dialog box should have presented
you with that information.

There are two Fortran compilers in the package, g77.exe and
gfortran.exe.

c:\>gfortran --version
GNU Fortran (GCC) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING
 
W

W. eWatson

Did you read the Getting Started documentation on the mingw.org web
site?
Completely missed it, or assumed that it would be a simple download and
install like many MS products. Found the download quickly, and started
there. I think the basis for MinGW looks like Linux, which I used long
ago with C and maybe Perl and others.

I just copied Getting Started into MS Word to avoid printing all the
extra marginal stuff, and will print it shortly.
You must set the PATH variable for the command line tools, the default
installation for those tools is "\mingw\bin\" or "Program
It sounds like I should uninstall mingw and start again. I guess I was
expecting a simple install that's usually the case for most MS programs.

Since I'm using Win 7, I suspect I should add \mingw\bin\ to the end of
the system PATH variable. PATH = C:\stuff\...\morestuff;C:\mingw\bin\
Files\mingw\bin". The installation dialog box should have presented
you with that information. Don't recall.

There are two Fortran compilers in the package, g77.exe and
gfortran.exe.
I want gfortran. I believe it has a Make facility, which is key to what
I'm doing. I'm working with another fellow who is using G90 to recode an
old fortran program. He's working in a Linux environment.

Is there some sort of general users manual for it? I noticed on Getting
Started some GUI. Does that have a manual, and is it a separate install?

c:\>gfortran --version
GNU Fortran (GCC) 4.6.1
So gfortran is GNU fortran?

I tried joining the mailing list by providing my sbcglobal address.
Never got a confirmation. I then used my mail facility on my web host
site, and did get registered, and even logged into something. I have not
rcvd any mailings. Found a sort of forum where posts had been made, but
none looked current.

Ran into gmane.comp.gnu.mingw.user wandering around the mingw web pages.
It appears it might be a mailing list disguised as a newsgroup. Still
haven't figured how to reach it. Found this though:

http://en.wikipedia.org/wiki/Gmane
http://gmane.org/faq.php

Maybe that will help.
 
G

Geoff

Completely missed it, or assumed that it would be a simple download and
install like many MS products. Found the download quickly, and started
there. I think the basis for MinGW looks like Linux, which I used long
ago with C and maybe Perl and others.

I just copied Getting Started into MS Word to avoid printing all the
extra marginal stuff, and will print it shortly.
It sounds like I should uninstall mingw and start again. I guess I was
expecting a simple install that's usually the case for most MS programs.
I don't know that an uninstall is necessary but you will probably want
to install with the MSYS option to get the *nix terminal environment
that you'll need to run make and the other tools. This will also put
you in a home directory where you can begin your project. Running MSYS
also makes fooling with PATH unnecessary.
Since I'm using Win 7, I suspect I should add \mingw\bin\ to the end of
the system PATH variable. PATH = C:\stuff\...\morestuff;C:\mingw\bin\
Don't recall.

It was in the GUI installer, just after the license dialog. One
important caveat, DON'T install to a path with spaces in it. Take the
default c:\mingw.
I want gfortran. I believe it has a Make facility, which is key to what
I'm doing. I'm working with another fellow who is using G90 to recode an
old fortran program. He's working in a Linux environment.

Is there some sort of general users manual for it? I noticed on Getting
Started some GUI. Does that have a manual, and is it a separate install?
The only GUI program is the installer, all the other tools are
command-line. You might be able to customize a third-party tool like
UltraEdit to be your IDE for the tools.
So gfortran is GNU fortran?

I tried joining the mailing list by providing my sbcglobal address.
Never got a confirmation. I then used my mail facility on my web host
site, and did get registered, and even logged into something. I have not
rcvd any mailings. Found a sort of forum where posts had been made, but
none looked current.

Ran into gmane.comp.gnu.mingw.user wandering around the mingw web pages.
It appears it might be a mailing list disguised as a newsgroup. Still
haven't figured how to reach it. Found this though:

http://en.wikipedia.org/wiki/Gmane
http://gmane.org/faq.php

Maybe that will help.

Yes, I am far from expert in MinGW, it's a tool I use occasionally,
nothing more.
 
G

gwowen

The only GUI program is the installer, all the other tools are
command-line. You might be able to customize a third-party tool like
UltraEdit to be your IDE for the tools.

I believe Code::Blocks is an IDE with reasonable MinGW compatibility
http://wiki.codeblocks.org/index.php?title=MinGW_installation
Some colleague use it - I don't.

It is. g77 is (basically) Fortran77 only, gfortran supports things
from Fortran90 and later. I don't know whether the whole standard is
covered - it wasn't when I last used it but that was 5 years ago.
Yes, I am far from expert in MinGW, it's a tool I use occasionally,
nothing more.

I use the tdragon MinGW releases (http://tdm-gcc.tdragon.net/) almost
every day, but only for GCC and G++, and only from an MSYS command
line or within emacs...
 
W

W. eWatson

I believe Code::Blocks is an IDE with reasonable MinGW compatibility
http://wiki.codeblocks.org/index.php?title=MinGW_installation
Some colleague use it - I don't.


It is. g77 is (basically) Fortran77 only, gfortran supports things
from Fortran90 and later. I don't know whether the whole standard is
covered - it wasn't when I last used it but that was 5 years ago.


I use the tdragon MinGW releases (http://tdm-gcc.tdragon.net/) almost
every day, but only for GCC and G++, and only from an MSYS command
line or within emacs...

Does it allow for "free form" on lines? That is, no column # concerns.
 
W

W. eWatson

gfortran definitely. g77, can't remember, its been so long.
A quick google suggests it does.
http://uw714doc.sco.com/cgi-bin/info2html?(g77.info)Source%20Form&lang=en

OK, I uninstalled, and added mysys to the install. I got to the
folder/mingw/bin and entered mingw-get forthran gdb.

I had added to my PATH: ;C:\MinGW\bin

After a few lines it tells me "**ERROR** pkg
gcc-fortran-4.6.1-2-mingw32-bin.bar.lzma is already installed."

It then tried to install (with ERROR) gdb-7.3.1=1 ... lsmza, which it
claims is installed already.

Then it tries installing a gdb-7.3 ... doc file with success.

So where am I? I don't see gfortran on the Win 7 start menu.

(BTW, how do I copy anything from the shell window?)

A search for gfortran turns up gfortran.exe

Ah, I do see under Users\Wayne\Fortran\SourceForge\bin the gfortran.exe
file.

I'm sending this as is, and will report back if I get gfortran to
execute successfully, or my computer blew up. :)
 
W

W. eWatson

....
I'm sending this as is, and will report back if I get gfortran to
execute successfully, or my computer blew up. :)

Well it didn't blow up, and I tried executed at the command prompt in
bin. Apparently, it needs an input file. Probably helloworld.for or
something. I tried to create something vi, but it appears to have pulled
it out of of a WATCOM f77 install, which I do not use.

OK, I found for program that was incomplete, and used it. It gave me
enough info when I tried to compile it that I do have a working fortran
compiler.

So where is a users manual that will tell me more, and where is the gdb
doc I mentioned? Is there a choice of an editor here that I can access
w/o drifing off to WATCOM f77 vi editor? I presume there's a Make
ability here, and I have a make file I could try it on.

Definite progress.
 
G

Geoff

So where am I? I don't see gfortran on the Win 7 start menu.

You should end up with a MinGW group and MinGW Shell shortcut in your
Programs group. The shortcut to the shell sets up your environment.
The shell home directory has the absolute Windows path of:
C:\MinGW\msys\1.0\home\Username so you need to create a Windows
Explorer shortcut to open that for copying files to it. You can also
open a quick explorer shell by typing "explorer ." at the prompt,
without the quotes of course.

You don't do another mingw-get. You already have everything via the
installer.

Here's a Fortran 77 program that compiles correctly and prints command
line arguments it receives. I just grabbed it off the web, I don't
have anything in newer Fortran.

--------------- cut here ---------------
program main

c*********************************************************************72
c
cc MAIN is the main program for ARGS.
c
c Discussion:
c
c ARGS demonstrates the use of the (semi-standard) GETARGS utility.
c
c Licensing:
c
c This code is distributed under the GNU LGPL license.
c
c Modified:
c
c 24 January 2009
c
c Author:
c
c John Burkardt
c
c Modified:
c
c 26 April 2007
c
c Author:
c
c John Burkardt
c
c Usage:
c
c args arg1 arg2 arg3 ...
c
implicit none

character * ( 80 ) arg
integer i
integer iargc
integer numarg

call timestamp ( )
write ( *, '(a)' ) ' '
write ( *, '(a)' ) 'ARGS'
write ( *, '(a)' ) ' FORTRAN77 version'
write ( *, '(a)' ) ' Demonstrate the use of the command line'
write ( *, '(a)' ) ' argument routines GETARG and IARGC.'

numarg = iargc ( )

write ( *, '(a)' ) ' '
write ( *, '(a,i8,a)' )
& ' ARGS was called with IARGC() = ', numarg, ' arguments.'

write ( *, '(a)' ) ' '
write ( *, '(a)' ) ' CALL GETARG(I,ARG) returns the arguments:'
write ( *, '(a)' ) ' '
write ( *, '(a)' ) ' I ARG '
write ( *, '(a)' ) ' '

do i = 0, numarg
call getarg ( i, arg )
write ( *, '(2x,i3,2x,a)' ) i, arg
end do

write ( *, '(a)' ) ' '
write ( *, '(a)' ) 'ARGS:'
write ( *, '(a)' ) ' Normal end of execution.'
write ( *, '(a)' ) ' '
call timestamp ( )

stop
end
subroutine timestamp ( )

c*********************************************************************72
c
cc TIMESTAMP prints out the current YMDHMS date as a timestamp.
c
c Discussion:
c
c This FORTRAN77 version is made available for cases where the
c FORTRAN90 version cannot be used.
c
c Licensing:
c
c This code is distributed under the GNU LGPL license.
c
c Modified:
c
c 24 January 2009
c
c Author:
c
c John Burkardt
c
c Modified:
c
c 12 January 2007
c
c Author:
c
c John Burkardt
c
c Parameters:
c
c None
c
implicit none

character * ( 8 ) ampm
integer d
character * ( 8 ) date
integer h
integer m
integer mm
character * ( 9 ) month(12)
integer n
integer s
character * ( 10 ) time
integer y

save month

data month /
& 'January ', 'February ', 'March ', 'April ',
& 'May ', 'June ', 'July ', 'August ',
& 'September', 'October ', 'November ', 'December ' /

call date_and_time ( date, time )

read ( date, '(i4,i2,i2)' ) y, m, d
read ( time, '(i2,i2,i2,1x,i3)' ) h, n, s, mm

if ( h .lt. 12 ) then
ampm = 'AM'
else if ( h .eq. 12 ) then
if ( n .eq. 0 .and. s .eq. 0 ) then
ampm = 'Noon'
else
ampm = 'PM'
end if
else
h = h - 12
if ( h .lt. 12 ) then
ampm = 'PM'
else if ( h .eq. 12 ) then
if ( n .eq. 0 .and. s .eq. 0 ) then
ampm = 'Midnight'
else
ampm = 'AM'
end if
end if
end if

write ( *,
& '(i2,1x,a,1x,i4,2x,i2,a1,i2.2,a1,i2.2,a1,i3.3,1x,a)' )
& d, month(m), y, h, ':', n, ':', s, '.', mm, ampm

return
end

-------------- cut here -------------

compile:
$ gfortran -o args args.f

run:
$ args test1 test2
26 December 2011 4:25:45.691 PM

ARGS
FORTRAN77 version
Demonstrate the use of the command line
argument routines GETARG and IARGC.

ARGS was called with IARGC() = 2 arguments.

CALL GETARG(I,ARG) returns the arguments:

I ARG

0 C:\MinGW\msys\1.0\home\Geoff\args.exe

1 test1

2 test2


ARGS:
Normal end of execution.

26 December 2011 4:25:45.704 PM

----------------

Hello World in Fortran 90:

program helloworld
write (*,*) "Hello, world."
end program helloworld
 
W

W. eWatson

You should end up with a MinGW group and MinGW Shell shortcut in your
Programs group. The shortcut to the shell sets up your environment. ....

Hello World in Fortran 90:

program helloworld
write (*,*) "Hello, world."
end program helloworld

Thanks for the tips, and the programs. I think I need to find next some
docs like a users manual for gfortran and graphics, etc. I think I can
get them through queries on the mingw mail list, but something seems
amiss there. I hope to have that cleared up today.

Oddly, despite the fact I only requested gfortran, I seem to have gotten
other compilers including Python.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top