Re: No linking occurs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 30 November 2010 14:07, Gunnar Sperber wrote:
>  After repeated trouble, I made the simplest possible
> test.  This is my program file listing:
>
> Knoth.f95(~)-gedit
>
> program nothing
> end
>
>
> and this is my attempt to make an object file:
>
>
>      ~$ gfortran -c Knoth.f95

this compiles Knoth.f95 and creates the output file Knoth.o

>      ~$ gfortran -o Knoth.o

Now you're telling gfortran to create the output file Knoth.o, but
without giving it an input file, so you get this error:

> gfortran: no input files; unwilling to write output files

This was because the -o option takes an argument, the name of the output file.

The file exists because the first command created it:

>      ~$ file Knoth.o
> Knoth.o : ELF 32-bit LSB relocatable, Intel 80386, version 1
>             (SYSV), not stripped


> What has gone wrong here?

You are running two commands when you only need to run one.
If you just want to compile and link Knoth.f95 just do this:

gfortran Knoth.f95

That's all you need.

If you really want to compile and link in two steps, you need to fix
your second command:

gfortran -c Knoth.f95
gfortran -o Knoth Knoth.o



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux