Link error while compiling fortran

Mark Hadfield
Tue Jan 11 22:48:00 GMT 2005

Chad Neufeld wrote:
> Hi,
> I have just updated my cygwin installation (January 11, 2005) and I can no
> longer compile my fortran programs from the command line.
 > [snip]
> This is what I type at the command line to compile a program:
> 	$ fl32 facqual.for
> This is the output from the fortran compiler.  Please note the error message
> on the last two lines:
> 	Compaq Visual Fortran Optimizing Compiler Version 6.6 (Update C)
> 	Copyright 2003 Compaq Computer Corp. All rights reserved.
> 	facqual.for
> 	/usr/bin/link: too many arguments
> 	Try `/usr/bin/link --help' for more information.

The CVF compiler is calling the wrong "link" command. It should be finding

   C:\Program Files\Microsoft Visual Studio\VC98\BIN\LINK.EXE

(may be different on your system) and it's actually finding the link 
installed by Cygwin (part of Gnu coreutils).

A similar issue will probably arise if you use the CVF command "df" to 
invoke the compiler. This will call Cygwin df (free disk space utility).

You need to bring the appropriate directories to the front of your PATH 
before trying to compile or link with CVF. You will probably also need 
to set up other environment variables, like LIB and INCLUDE. I believe 
CVF offers to modify your master environment accordingly during 
installation, but this offer is best declined, as the CVF commands will 
then hide the Cygwin ones. CVF also installs a .BAT file somehwere to 
set up environment variables--you can use this from a Windows command 
prompt. Me, I normally invoke CVF (version 6.6.C, same as you) from the 
Cygwin bash shell and I have a bash function that sets everything up:

dfvars ()
     echo Setting environment variables for Compaq Visual Fortran 6;
     msdev='C:\Program Files\Microsoft Visual Studio';
     export MSDEVDIR=$msdev\\Common\\MSDEV98;
     export TOOLSDIR=$msdev\\Common\\TOOLS;
     export DFDIR=$msdev\\DF98;
     export VCDIR=$msdev\\VC98;
     export MSDEVDIR_POSIX=$(cygpath --unix "$MSDEVDIR");
     export TOOLSDIR_POSIX=$(cygpath --unix "$TOOLSDIR");
     export DFDIR_POSIX=$(cygpath --unix "$DFDIR");
     export VCDIR_POSIX=$(cygpath --unix "$VCDIR");
     export INCLUDE=$DFDIR\\Include';'$VCDIR\\Include;
     export LIB=$DFDIR\\Lib';'$VCDIR\\Lib;
     export DF="/nologo /traceback"

Mark Hadfield            "Ka puwaha te tai nei, Hoea tatou"
National Institute for Water and Atmospheric Research (NIWA)

Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list